Esempio n. 1
0
        private void count()
        {
            StretchOption[] opts = new StretchOption[0];
            if (chUse == 1)
            {
                opts    = new StretchOption[3];
                opts[0] = new StretchOption(0, 0, points[0, 0], points[0, 1]);
                opts[1] = new StretchOption(points[0, 0], points[0, 1], points[1, 0], points[1, 1]);
                opts[2] = new StretchOption(points[1, 0], points[1, 1], 255, 255);
            }
            else
            {
                opts    = new StretchOption[3 * 3];
                opts[0] = new StretchOption(0, 0, points[0, 0], points[0, 1], MyDeal.colorMode.R);
                opts[1] = new StretchOption(points[0, 0], points[0, 1], points[1, 0], points[1, 1], MyDeal.colorMode.R);
                opts[2] = new StretchOption(points[1, 0], points[1, 1], 255, 255, MyDeal.colorMode.R);

                opts[3] = new StretchOption(0, 0, points[2, 0], points[2, 1], MyDeal.colorMode.G);
                opts[4] = new StretchOption(points[2, 0], points[2, 1], points[3, 0], points[3, 1], MyDeal.colorMode.G);
                opts[5] = new StretchOption(points[3, 0], points[3, 1], 255, 255, MyDeal.colorMode.G);

                opts[6] = new StretchOption(0, 0, points[4, 0], points[4, 1], MyDeal.colorMode.B);
                opts[7] = new StretchOption(points[4, 0], points[4, 1], points[5, 0], points[5, 1], MyDeal.colorMode.B);
                opts[8] = new StretchOption(points[5, 0], points[5, 1], 255, 255, MyDeal.colorMode.B);
            }
            outView = MyDeal.stretch(imgView, opts);
        }
Esempio n. 2
0
        private void trackBar_ValueChanged(object sender, EventArgs e)
        {
            TrackBar here = (TrackBar)sender;

            if (chUse == 1)
            {// only one channel mode
                if (here.Tag.Equals("CH1"))
                {
                    trackBar2.Value = 0;
                    trackBar3.Value = 0;
                    outView         = MyDeal.threshold(imgView, here.Value, colorMode.GRAY);
                }
            }
            else
            {
                int[] thresholds = new int[3];
                thresholds[2] = trackBar1.Value; //R
                thresholds[1] = trackBar2.Value; //G
                thresholds[0] = trackBar3.Value; //B
                outView       = MyDeal.threshold(imgView, thresholds);
            }
            if (here.Tag.Equals("CH1"))
            {
                textBox1.Text = here.Value.ToString();
            }
            else if (here.Tag.Equals("CH2"))
            {
                textBox2.Text = here.Value.ToString();
            }
            else if (here.Tag.Equals("CH3"))
            {
                textBox3.Text = here.Value.ToString();
            }
        }
Esempio n. 3
0
 public bool set(byte[] src)
 {
     try
     {
         MyDeal.setTByBytes(ref manufacturer, src, 0);
         MyDeal.setTByBytes(ref version, src, 1);
         MyDeal.setTByBytes(ref encoding, src, 2);
         MyDeal.setTByBytes(ref bitsPerPixel, src, 3);
         MyDeal.setTByBytes(ref Xmin, src, 4);
         MyDeal.setTByBytes(ref Ymin, src, 6);
         MyDeal.setTByBytes(ref Xmax, src, 8);
         MyDeal.setTByBytes(ref Ymax, src, 10);
         MyDeal.setTByBytes(ref Hdpi, src, 12);
         MyDeal.setTByBytes(ref Vdpi, src, 14);
         MyDeal.setBytesByBytes(ref colorMap, src, 16, 48);
         MyDeal.setTByBytes(ref reserved, src, 64);
         MyDeal.setTByBytes(ref nPlanes, src, 65);
         MyDeal.setTByBytes(ref bytesPerLine, src, 66);
         MyDeal.setTByBytes(ref paletteInfo, src, 68);
         MyDeal.setTByBytes(ref hScreenSize, src, 70);
         MyDeal.setTByBytes(ref vScreenSize, src, 72);
         MyDeal.setBytesByBytes(ref filler, src, 74, 54);
     }
     catch (Exception e)
     {
         Debug.Print(e.ToString());
         return(false);
     }
     return(true);
 }
Esempio n. 4
0
 protected override void pictureBox1_Paint(object sender, PaintEventArgs e)
 {
     int[] thresholds = new int[3];
     thresholds[2] = trackBar1.Value; //R
     thresholds[1] = trackBar2.Value; //G
     thresholds[0] = trackBar3.Value; //B
     outView       = MyDeal.threshold(imgView, thresholds);
 }
Esempio n. 5
0
 public Form_BitPlane(Form1 form1) : base(form1)
 {
     InitializeComponent();
     Input1 = MyDeal.gray(form1.Img[0]);
     mode   = (int)imgMode.GRAY;
     toolStripStatusLabel3.Visible = true;
     toolStripStatusLabel3.Text    = SNRText;
     count();
 }
Esempio n. 6
0
        private void resize()
        {
            MyDeal.valueMethod resizeMethod = MyDeal.valueMethod.Nearly;
            progress.start();
            switch (comboBox1.SelectedIndex)
            {
            case 0:
                resizeMethod = MyDeal.valueMethod.Nearly;
                break;

            case 1:
                resizeMethod = MyDeal.valueMethod.Linear;
                break;
            }
            double[] rate   = { 0.5, 1.0, 2.0 };
            int      choose = 1;

            foreach (RadioButton select in panel1.Controls)
            {
                if (select.Checked)
                {
                    choose = select.TabIndex;
                }
            }
            if ((choose < 0) || (choose > 2))
            {
                choose = 1;
            }
            progress.fine();
            tempView = MyDeal.resize(imgView, rate[choose], resizeMethod, progress);

            progress.start();
            switch (comboBox2.SelectedIndex)
            {
            case 0:
                resizeMethod = MyDeal.valueMethod.Nearly;
                break;

            case 1:
                resizeMethod = MyDeal.valueMethod.Linear;
                break;
            }
            foreach (RadioButton select in panel2.Controls)
            {
                if (select.Checked)
                {
                    choose = select.TabIndex;
                }
            }
            if ((choose < 0) || (choose > 2))
            {
                choose = 1;
            }
            progress.fine();
            outView = MyDeal.resize(tempView, rate[choose], resizeMethod, progress);
        }
        protected override void button1_Click(object sender, EventArgs e)
        {
            base.button1_Click(sender, e);
            outView = MyDeal.subBitmap(imgView, countOutView, 127);
            double SNR = MyDeal.SNR(imgView, outView);

            string[] blurInfo = textBox2.Lines;
            blurInfo[2]    = info[2] + SNR.ToString("0.00");
            textBox2.Lines = blurInfo;
        }
Esempio n. 8
0
        private void button1_Click(object sender, EventArgs e)
        {
            MyFilter.FilterCount countMethod = MyFilter.highBoost;
            double   SNR      = 0.0;
            double   costTime = 0;
            DateTime curTime  = DateTime.Now;

            outView        = MyDeal.filter2D(imgView, MyFilter.BorderMethod.NEAR, countMethod, countFilter, progress);
            costTime       = DateTime.Now.Subtract(curTime).TotalMilliseconds;
            SNR            = MyDeal.SNR(imgView, outView);
            textBox1.Lines = countInfo(comboBox1.Text, (double)trackBar1.Value / 100, SNR, costTime);
        }
        private void addLine(Bitmap view, Chart chart)
        {//add cdf line
            try
            {
                Series target;
                if (view == null)
                {
                    return;
                }
                if (chart == null)
                {
                    return;
                }
                switch (mode)
                {
                case (int)imgMode.GRAY:
                    target = MyDeal.buildSeries(view, MyDeal.colorMode.GRAY, MyDeal.seriesMode.CDF);
                    chart.Series.Add(target);
                    return;

                case (int)imgMode.R:
                    target = MyDeal.buildSeries(view, MyDeal.colorMode.R, MyDeal.seriesMode.CDF);
                    chart.Series.Add(target);
                    return;

                case (int)imgMode.G:
                    target = MyDeal.buildSeries(view, MyDeal.colorMode.G, MyDeal.seriesMode.CDF);
                    chart.Series.Add(target);
                    return;

                case (int)imgMode.B:
                    target = MyDeal.buildSeries(view, MyDeal.colorMode.B, MyDeal.seriesMode.CDF);
                    chart.Series.Add(target);
                    return;

                case (int)imgMode.ORI:
                case (int)imgMode.NEG:
                default:
                    target = MyDeal.buildSeries(view, MyDeal.colorMode.R, MyDeal.seriesMode.CDF);
                    chart.Series.Add(target);
                    target = MyDeal.buildSeries(view, MyDeal.colorMode.G, MyDeal.seriesMode.CDF);
                    chart.Series.Add(target);
                    target = MyDeal.buildSeries(view, MyDeal.colorMode.B, MyDeal.seriesMode.CDF);
                    chart.Series.Add(target);
                    return;
                }
            }
            catch (Exception e)
            {
                Debug.Print(e.ToString() + e.StackTrace);
            }
        }
Esempio n. 10
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (openFileDialog1.ShowDialog() == DialogResult.OK)
     {
         InputCur = openPCX(openFileDialog1.FileName, null, pictureBox1, MyDeal.gray);
         mode     = (int)imgMode.GRAY;
     }
     else
     {
         InputCur = null;
     }
     toolStripStatusLabel3.Text = SNRText + MyDeal.SNR(InputCur, InputRef);
 }
Esempio n. 11
0
 private void button5_Click(object sender, EventArgs e)
 {
     if (f != null)
     {
         f.connect(monitor);
         InputCur = f.decode(InputCur);
         toolStripStatusLabel3.Text = SNRText + MyDeal.SNR(InputCur, InputRef);
     }
     else
     {
         MessageBox.Show("No Import Fractal to Decode !!");
     }
 }
Esempio n. 12
0
        private void rotate()
        {
            switch (comboBox1.SelectedIndex)
            {
            case 0:
                outView = MyDeal.rotate(imgView, trackBar1.Value, MyDeal.RotateMethod.posi, progress);
                break;

            case 1:
            default:
                outView = MyDeal.rotate(imgView, trackBar1.Value, MyDeal.RotateMethod.nega, progress);
                break;
            }
        }
Esempio n. 13
0
        protected void buildChart(Bitmap view, Chart chart1)
        {
            try
            {
                chart1.Series.Clear();
                if (view == null)
                {
                    return;
                }
                switch (mode)
                {
                case (int)imgMode.GRAY:
                    seriesT = MyDeal.buildSeries(view, MyDeal.colorMode.GRAY);
                    chart1.Series.Add(seriesT);
                    return;

                case (int)imgMode.R:
                    seriesT = MyDeal.buildSeries(view, MyDeal.colorMode.R);
                    chart1.Series.Add(seriesT);
                    return;

                case (int)imgMode.G:
                    seriesT = MyDeal.buildSeries(view, MyDeal.colorMode.G);
                    chart1.Series.Add(seriesT);
                    return;

                case (int)imgMode.B:
                    seriesT = MyDeal.buildSeries(view, MyDeal.colorMode.B);
                    chart1.Series.Add(seriesT);
                    return;

                case (int)imgMode.ORI:
                case (int)imgMode.NEG:
                default:
                    seriesR = MyDeal.buildSeries(view, MyDeal.colorMode.R);
                    chart1.Series.Add(seriesR);

                    seriesG = MyDeal.buildSeries(view, MyDeal.colorMode.G);
                    chart1.Series.Add(seriesG);

                    seriesB = MyDeal.buildSeries(view, MyDeal.colorMode.B);
                    chart1.Series.Add(seriesB);
                    return;
                }
            }
            catch (Exception e)
            {
                Debug.Print(e.ToString());
            }
        }
Esempio n. 14
0
        protected virtual void button1_Click(object sender, EventArgs e)
        {
            MyFilter.FilterCount countMethod = null;
            double SNR      = 0.0;
            double costTime = 0;

            if (radioButton1.Checked)
            {
                countMethod = MyFilter.meanBlur;
            }
            else if (radioButton2.Checked)
            {
                countMethod = MyFilter.medianBlur;
            }
            else if (radioButton3.Checked)
            {
                countMethod = MyFilter.pseudoMedianBlur;
            }
            DateTime curTime = DateTime.Now;
            MyFilter filter  = new MyFilter(trackBar1.Value);

            if (radioButton4.Checked)//rect
            {
                filter.setData(1.0);
            }
            else if (radioButton5.Checked)
            {//cross
                filter.setData(Double.NegativeInfinity);
                if (trackBar1.Value % 2 == 0)
                {//even
                    int st, ed;
                    ed = trackBar1.Value / 2;
                    st = ed - 1;
                    filter.setData(st, 0, ed, trackBar1.Value - 1, 1.0);
                    filter.setData(0, st, trackBar1.Value - 1, ed, 1.0);
                }
                else
                {//odd
                    int t = trackBar1.Value / 2;
                    filter.setData(t, 0, t, trackBar1.Value - 1, 1.0);
                    filter.setData(0, t, trackBar1.Value - 1, t, 1.0);
                }
            }
            countOutView   = MyDeal.filter2D(imgView, MyFilter.BorderMethod.NULL, countMethod, filter, progress);
            outView        = countOutView;
            costTime       = DateTime.Now.Subtract(curTime).TotalMilliseconds;
            SNR            = MyDeal.SNR(imgView, outView);
            textBox2.Lines = countInfo(countMethod, trackBar1.Value, SNR, costTime);
        }
Esempio n. 15
0
        void setAllByBytes(byte[] bytes, int byteSize)
        {
            header.set(bytes);
            switch (header.nPlanes)
            {
            case 1:
                MyDeal.setBytesByBytes(ref data, bytes, headerSize, byteSize - palette256Space - headerSize);      //set data
                MyDeal.setBytesByBytes(ref colorPalette, bytes, byteSize - palette256Space, palette256Space);      //set palette
                setPalette();
                break;

            case 3:
                MyDeal.setBytesByBytes(ref data, bytes, headerSize, byteSize - headerSize);        //set data
                colorPalette = null;
                setPalette();
                break;

            default:
                MyDeal.setBytesByBytes(ref data, bytes, headerSize, byteSize - palette256Space - headerSize);      //set data
                MyDeal.setBytesByBytes(ref colorPalette, bytes, byteSize - palette256Space, palette256Space);      //set palette
                setPalette();
                break;
            }
        }
Esempio n. 16
0
        private void count()
        {
            Input1 = Input1;
            Input2 = Input2;
            for (int i = 7; i >= trackBar1.Value; i--)
            {
                planes[i] = input1P[i];
            }
            for (int i = trackBar1.Value - 1, j = 7; (i >= 0) && (j >= 0); i--, j--)
            {
                planes[i] = input2P[j];
            }

            pictureBox4.Image          = planes[7];
            pictureBox5.Image          = planes[6];
            pictureBox6.Image          = planes[5];
            pictureBox7.Image          = planes[4];
            pictureBox8.Image          = planes[3];
            pictureBox9.Image          = planes[2];
            pictureBox10.Image         = planes[1];
            pictureBox11.Image         = planes[0];
            Output                     = planes.merge(CodingMode);
            toolStripStatusLabel3.Text = SNRText + MyDeal.SNR(Input1, Output).ToString("0.00");
        }
Esempio n. 17
0
        private void button1_Click(object sender, EventArgs e)
        {
            MyFilter.FilterCount countMethod = null;
            switch (comboBox1.SelectedIndex)
            {           //operate
            case 0:     //SOBEL
                switch (comboBox2.SelectedIndex)
                {       //direct
                case 0: //BOTH
                    countMethod = MyFilter.gradient(MyFilter.GradientOperator.SOBEL, MyFilter.GradientDirect.BOTH);
                    break;

                case 1:        //X
                    countMethod = MyFilter.gradient(MyFilter.GradientOperator.SOBEL, MyFilter.GradientDirect.X);
                    break;

                case 2:        //Y
                    countMethod = MyFilter.gradient(MyFilter.GradientOperator.SOBEL, MyFilter.GradientDirect.Y);
                    break;
                }
                break;

            case 1:     //PREWITT
                switch (comboBox2.SelectedIndex)
                {       //direct
                case 0: //BOTH
                    countMethod = MyFilter.gradient(MyFilter.GradientOperator.PREWITT, MyFilter.GradientDirect.BOTH);
                    break;

                case 1:        //X
                    countMethod = MyFilter.gradient(MyFilter.GradientOperator.PREWITT, MyFilter.GradientDirect.X);
                    break;

                case 2:        //Y
                    countMethod = MyFilter.gradient(MyFilter.GradientOperator.PREWITT, MyFilter.GradientDirect.Y);
                    break;
                }
                break;

            case 2:     //ROBERT
                switch (comboBox2.SelectedIndex)
                {       //direct
                case 0: //BOTH
                    countMethod = MyFilter.gradient(MyFilter.GradientOperator.ROBERT, MyFilter.GradientDirect.BOTH);
                    break;

                case 1:        //X
                    countMethod = MyFilter.gradient(MyFilter.GradientOperator.ROBERT, MyFilter.GradientDirect.X);
                    break;

                case 2:        //Y
                    countMethod = MyFilter.gradient(MyFilter.GradientOperator.ROBERT, MyFilter.GradientDirect.Y);
                    break;
                }
                break;
            }
            double   SNR      = 0.0;
            double   costTime = 0;
            DateTime curTime  = DateTime.Now;

            outView        = MyDeal.filter2D(imgView, MyFilter.BorderMethod.NEAR, countMethod, null, progress);
            costTime       = DateTime.Now.Subtract(curTime).TotalMilliseconds;
            SNR            = MyDeal.SNR(imgView, outView);
            textBox1.Lines = countInfo(comboBox1.Text, comboBox2.Text, SNR, costTime);
        }
 private void count()
 {
     outView = MyDeal.equalize(imgView);
 }
Esempio n. 19
0
 public Form_FractalFile(Form1 form1) : base(form1)
 {
     InitializeComponent();
     InputCur = MyDeal.gray(form1.Img[0]);
     initial();
 }
Esempio n. 20
0
 private void mirror()
 {
     outView = MyDeal.mirror(imgView, trackBar1.Value, progress);
 }
Esempio n. 21
0
 private void count()
 {
     Output = MyDeal.opacity(Input1, Input2, trackBar1.Value, useMask);
     toolStripStatusLabel3.Text = SNRText + MyDeal.SNR(Input1, Output).ToString("0.00");
 }
 private void count()
 {
     outView = MyDeal.specification(imgView, refView);
 }