Example #1
0
        public Bitmap c2bQR(Bitmap bmp)
        {
            Bitmap tmp = ecB.Apply(bmp);

            tmp = bw.Apply(tmp);
            return(tmp);
        }
Example #2
0
        private void UpdateChannelPreviews(System.Drawing.Bitmap pic)
        {
            ExtractChannel r = new ExtractChannel(RGB.R);
            ExtractChannel g = new ExtractChannel(RGB.G);
            ExtractChannel b = new ExtractChannel(RGB.B);

            System.Drawing.Bitmap rImage = null;
            System.Drawing.Bitmap gImage = null;
            System.Drawing.Bitmap bImage = null;

            // apply the filter
            if (pic != null)
            {
                rImage = r.Apply(pic);
                gImage = g.Apply(pic);
                bImage = b.Apply(pic);
            }
            else
            {
                rImage = r.Apply(mainPhoto);
                gImage = g.Apply(mainPhoto);
                bImage = b.Apply(mainPhoto);
            }

            RedChannelbmp   = ToBitmapImage(rImage);
            GreenChannelbmp = ToBitmapImage(gImage);
            BlueChannelbmp  = ToBitmapImage(bImage);
        }
Example #3
0
        private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
        {
            switch (comboBox2.SelectedIndex)
            {
            case 0:
                selected = redFilter;
                break;

            case 1:
                selected = greenFilter;
                break;

            case 2:
                selected = blueFilter;
                break;

            default:
                break;
            }
            Bitmap channel = selected.Apply((Bitmap)pictureBox1.Image);

            thresholdFilter = new Threshold(Int32.Parse(textBox1.Text));
            thresholdFilter.ApplyInPlace(channel);
            pictureBox2.Image = channel;
        }
Example #4
0
        private void button5_Click(object sender, EventArgs e)
        {
            ExtractChannel filter = new ExtractChannel(RGB.B);

            img2 = filter.Apply(img1);
            pictureBox2.Image = img2;
        }
Example #5
0
        public Bitmap ToExtractChannel(Bitmap Im)
        {
            AForge.Imaging.Filters.ExtractChannel Img = new ExtractChannel();
            Bitmap bmImage = AForge.Imaging.Image.Clone(new Bitmap(Im), PixelFormat.Format24bppRgb);

            return(Img.Apply(bmImage));
        }
        public void ApplyTest()
        {
            Signal target = Signal.FromArray(data, 8000);

            for (int c = 0; c < 2; c++)
            {
                ExtractChannel extract = new ExtractChannel(c);

                var result = extract.Apply(target);


                Assert.AreEqual(result.Length, 6);
                Assert.AreEqual(result.Samples, 6);
                Assert.AreEqual(result.Channels, 1);
                Assert.AreEqual(result.SampleRate, 8000);

                float[] actual   = result.ToFloat();
                float[] expected = data.GetColumn(c);

                for (int i = 0; i < actual.Length; i++)
                {
                    Assert.AreEqual(expected[i], actual[i]);
                }
            }
        }
Example #7
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            pictureBox1.Image = new Bitmap(Bitmap.FromFile("C:\\testimg\\" + comboBox1.SelectedIndex + ".png"), pictureBox1.Size);
            Bitmap channel = selected.Apply((Bitmap)pictureBox1.Image);

            thresholdFilter = new Threshold(Int32.Parse(textBox1.Text));
            thresholdFilter.ApplyInPlace(channel);
            pictureBox2.Image = channel;
            pictureBox3.Image = brownFilter.Apply((Bitmap)pictureBox1.Image);
        }
        /// <summary>
        /// Extracts Images from smallSize CameraImage, No feed Back given during process
        /// </summary>
        /// <param name="SmallCameraImage"></param>
        /// <param name="OMRSpecsSheetAddress"></param>
        /// <returns>Formated, Right sized OMR Sheet</returns>
        private Bitmap flatten(Bitmap bmp, int fillint, int contint)
        {
            // step 1 - turn background to black
            ColorFiltering colorFilter = new ColorFiltering();

            colorFilter.Red              = new IntRange(0, fillint);
            colorFilter.Green            = new IntRange(0, fillint);
            colorFilter.Blue             = new IntRange(0, fillint);
            colorFilter.FillOutsideRange = false;
            colorFilter.ApplyInPlace(bmp);
            AForge.Imaging.Filters.ContrastCorrection Contrast        = new ContrastCorrection(contint);
            AForge.Imaging.Filters.Invert             invert          = new Invert();
            AForge.Imaging.Filters.ExtractChannel     extract_channel = new ExtractChannel(0);
            AForge.Imaging.Filters.Threshold          thresh_hold     = new Threshold(44);
            bmp = invert.Apply(thresh_hold.Apply(extract_channel.Apply(Contrast.Apply(bmp))));
            return(bmp);
        }
        private void process_button_Click(object sender, EventArgs e)
        {
            //changes are made here

            //Doing classic image layer by layer
            //modifying image layer by layer
            var extractRGBchannelFilter = new ExtractChannel();

            extractRGBchannelFilter.Channel = AForge.Imaging.RGB.G;//RGB.R RGB.B
            var redChannel       = extractRGBchannelFilter.Apply(_inputImage);
            var threshold        = new Threshold(150);
            var thresholdedImage = threshold.Apply(redChannel);

            var replacedFilter = new ReplaceChannel(AForge.Imaging.RGB.G, thresholdedImage);
            var replacedImage  = replacedFilter.Apply(_inputImage);

            pictureBoxOutput.Image = replacedImage;
        }
Example #10
0
        public static Tuple <Bitmap, Bitmap, Bitmap, Bitmap> getARGBA(Bitmap img)
        {
            img = ImageUtil.convert(img, PixelFormat.Format32bppArgb);

            ExtractChannel myFilter = new ExtractChannel(RGB.R);
            Bitmap         R        = myFilter.Apply(img);

            myFilter = new ExtractChannel(RGB.G);
            Bitmap G = myFilter.Apply(img);

            myFilter = new ExtractChannel(RGB.B);
            Bitmap B = myFilter.Apply(img);

            myFilter = new ExtractChannel(RGB.A);
            Bitmap A = myFilter.Apply(img);

            return(new Tuple <Bitmap, Bitmap, Bitmap, Bitmap>(R, G, B, A));
        }
Example #11
0
        public mSwapRGB(Bitmap BaseBitmap, int A, int R, int G, int B)
        {
            ExtractChannel cR = new ExtractChannel(RGB.R);
            ExtractChannel cG = new ExtractChannel(RGB.G);
            ExtractChannel cB = new ExtractChannel(RGB.B);

            ExtractChannel cA = new ExtractChannel(RGB.A);

            YCbCrExtractChannel cL = new YCbCrExtractChannel(YCbCr.YIndex);

            List <Bitmap> maps = new List <Bitmap>();

            Bitmap BmpA = new Bitmap(BaseBitmap.Width, BaseBitmap.Height, PixelFormat.Format16bppGrayScale);
            Bitmap BmpR = new Bitmap(BaseBitmap.Width, BaseBitmap.Height, PixelFormat.Format16bppGrayScale);
            Bitmap BmpG = new Bitmap(BaseBitmap.Width, BaseBitmap.Height, PixelFormat.Format16bppGrayScale);
            Bitmap BmpB = new Bitmap(BaseBitmap.Width, BaseBitmap.Height, PixelFormat.Format16bppGrayScale);
            Bitmap BmpL = new Bitmap(BaseBitmap.Width, BaseBitmap.Height, PixelFormat.Format16bppGrayScale);

            BmpA = cA.Apply(new Bitmap(BaseBitmap));
            BmpR = cR.Apply(new Bitmap(BaseBitmap));
            BmpG = cG.Apply(new Bitmap(BaseBitmap));
            BmpB = cB.Apply(new Bitmap(BaseBitmap));
            BmpL = cL.Apply(new Bitmap(BaseBitmap));

            maps.Add(BmpA);
            maps.Add(BmpR);
            maps.Add(BmpG);
            maps.Add(BmpB);
            maps.Add(BmpL);

            Bitmap bmp = new Bitmap(BaseBitmap.Width, BaseBitmap.Height, PixelFormat.Format32bppArgb);

            bmp.MakeTransparent();

            bmp = new ReplaceChannel(RGB.A, maps[A]).Apply(bmp);
            bmp = new ReplaceChannel(RGB.R, maps[R]).Apply(bmp);
            bmp = new ReplaceChannel(RGB.G, maps[G]).Apply(bmp);
            bmp = new ReplaceChannel(RGB.B, maps[B]).Apply(bmp);

            ModifiedBitmap = new Bitmap(bmp);
        }
Example #12
0
        public static Bitmap Sketch(Bitmap input, int redThreshold, int blueThreshold, int greenThreshold)
        {
            int[,] kernel = {
                { 1, 2, 1, },  
               { 2, 4, 2, },   
               { 1, 2, 1, },
            };
            Convolution convultionFilters = new Convolution(kernel);
            Threshold thresholdFilter = new Threshold(redThreshold);
            input = convultionFilters.Apply(input);
            // extract red channel
            ExtractChannel extractFilter = new ExtractChannel(RGB.R);
            Bitmap channel = extractFilter.Apply(input);
            // threshold channel
            thresholdFilter.ApplyInPlace(channel);
            // put the channel back
            ReplaceChannel replaceFilter = new ReplaceChannel(RGB.R, channel);
            replaceFilter.ApplyInPlace(input);

            // extract blue channel
            extractFilter = new ExtractChannel(RGB.B);
            channel = extractFilter.Apply(input);
            // threshold channel
            thresholdFilter.ThresholdValue = blueThreshold;
            thresholdFilter.ApplyInPlace(channel);
            // put the channel back
            replaceFilter = new ReplaceChannel(RGB.B, channel);
            replaceFilter.ApplyInPlace(input);
            
            // extract green channel
            extractFilter = new ExtractChannel(RGB.G);
            channel = extractFilter.Apply(input);
            // threshold channel
            thresholdFilter.ThresholdValue = greenThreshold;
            thresholdFilter.ApplyInPlace(channel);
            // put the channel back
            replaceFilter = new ReplaceChannel(RGB.G, channel);
            replaceFilter.ApplyInPlace(input);

            return input;
        }
Example #13
0
        /// <summary>
        /// This is the method that actually does the work.
        /// </summary>
        /// <param name="DA">The DA object is used to retrieve from inputs and store in outputs.</param>
        protected override void SolveInstance(IGH_DataAccess DA)
        {
            Bitmap sourceImage = null;

            DA.GetData(0, ref sourceImage);

            sourceImage = ImageUtil.convert(sourceImage, System.Drawing.Imaging.PixelFormat.Format32bppArgb);

            ExtractChannel myFilter = new ExtractChannel(RGB.R);

            DA.SetData(0, myFilter.Apply(sourceImage));

            myFilter = new ExtractChannel(RGB.G);
            DA.SetData(1, myFilter.Apply(sourceImage));

            myFilter = new ExtractChannel(RGB.B);
            DA.SetData(2, myFilter.Apply(sourceImage));

            myFilter = new ExtractChannel(RGB.A);
            DA.SetData(3, myFilter.Apply(sourceImage));
        }
        public static Bitmap PrepareForObjectDetection(this System.Drawing.Image bmpOriginalImage, int whiteLevel, bool overrideWhite)
        {
            Bitmap bmp = (Bitmap)bmpOriginalImage.Clone();

            ColorFiltering colorFilter = new ColorFiltering();

            int white = whiteLevel;

            if (!overrideWhite)
            {
                white = PreprocessingHelper.GetWhiteLevel(bmp);
            }

            colorFilter.Red              = new IntRange(0, white / 3);
            colorFilter.Green            = new IntRange(0, white / 3);
            colorFilter.Blue             = new IntRange(0, white / 3);
            colorFilter.FillOutsideRange = true;

            colorFilter.FillColor = new RGB(Color.White);
            colorFilter.ApplyInPlace(bmp);

            ExtractChannel extract_channel = new ExtractChannel(0);

            bmp = extract_channel.Apply(bmp);

            Invert invert = new Invert();

            invert.ApplyInPlace(bmp);

            Threshold threshholdFilter = new Threshold(10);

            threshholdFilter.ApplyInPlace(bmp);

            bmp = bmp.Clone(new Rectangle(0, 0, bmp.Width, bmp.Height), PixelFormat.Format24bppRgb);

            return(bmp);
        }
Example #15
0
        private void MainForm_Load(object sender, EventArgs e)
        {
            Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;

            Text = Text + " " + version.Major + "." + version.Minor + " (build " + version.Build + ")"; //change form title

            //todo: make this user selectable.
            SetWindowPos(this.Handle, HWND_TOPMOST, 0, 0, 0, 0, TOPMOST_FLAGS); // Set form as top form.  Always on top.
            AForge.Vision.Motion.MotionDetector motionDetector = null;
            motionDetector          = GetDefaultMotionDetector();
            globalTimer.Elapsed    += GlobalTimer_Elapsed;
            lureTimer.Elapsed      += LureTimer_Elapsed;
            baitTimer.Elapsed      += BaitTimer_Elapsed;
            screenUpdateTimer.Tick += ScreenUpdateTimer_Tick;

            screenStateLogger.ScreenRefreshed += (sender1, data) =>
            {
                //New frame in data
                System.Drawing.Image i = System.Drawing.Image.FromStream(new MemoryStream(data));
                origScreenHeight = i.Height;
                origScreenWidth  = i.Width;
                // todo:  The percentage of scan area should be able to be set on the form
                // To help in scan speed and to eliminate some of the external noise, only scan the center of the screen.

                int       left    = (int)(i.Width * 0.40);
                int       right   = (int)(i.Width * 0.60) - left;
                int       top     = (int)(i.Height * 0.50);
                int       bottom  = (int)(i.Height * 0.70) - top;
                Rectangle srcRect = new Rectangle(left, top, right, bottom);
                Bitmap    cropped = ((Bitmap)i).Clone(srcRect, i.PixelFormat);


                // depending on the area of the game it is sometimes best to remove some colors.

                if (rbGreyScaleFilter.Checked)
                {
                    cropped = Grayscale.CommonAlgorithms.BT709.Apply(cropped);
                }


                if (rbRedFilter.Checked)
                {
                    ExtractChannel extractFilter = new ExtractChannel(RGB.R);
                    cropped = extractFilter.Apply(cropped);
                }

                if (rbBlueFilter.Checked)
                {
                    ExtractChannel extractFilter = new ExtractChannel(RGB.B);
                    cropped = extractFilter.Apply(cropped);
                }

                if (rbGreenFilter.Checked)
                {
                    ExtractChannel extractFilter = new ExtractChannel(RGB.G);
                    cropped = extractFilter.Apply(cropped);
                }


                detectMovement((Bitmap)cropped);
                pbViewPane.Image = (Bitmap)cropped;
            };
            screenStateLogger.Start();
        }
Example #16
0
 private void button4_Click(object sender, EventArgs e)//B
 {
     filter            = new ExtractChannel(RGB.B);
     bmp2              = filter.Apply(bmp);
     pictureBox2.Image = bmp2;
 }
        void cam_NewFrame(object sender, NewFrameEventArgs eventArgs)
        {
            Bitmap realimage = (Bitmap)eventArgs.Frame.Clone();
            Bitmap rimage    = (Bitmap)eventArgs.Frame.Clone();
            Bitmap bimage    = (Bitmap)eventArgs.Frame.Clone();
            //Red Object detection
            GrayscaleBT709 grayscale = new GrayscaleBT709();
            Subtract       sfilter   = new Subtract(grayscale.Apply(rimage));
            ExtractChannel rchannel  = new ExtractChannel(RGB.R);
            ExtractChannel bchannel  = new ExtractChannel(RGB.B);

            rimage = rchannel.Apply(rimage);
            bimage = bchannel.Apply(bimage);
            sfilter.ApplyInPlace(rimage);
            sfilter.ApplyInPlace(bimage);
            Median mfilter = new Median(5);

            mfilter.ApplyInPlace(rimage);
            mfilter.ApplyInPlace(bimage);
            Threshold thresh = new Threshold(50);

            thresh.ApplyInPlace(rimage);
            thresh.ApplyInPlace(bimage);
            BlobCounter rblob = new BlobCounter();

            rblob.ObjectsOrder = ObjectsOrder.Area;
            rblob.ProcessImage(rimage);
            BlobCounter bblob = new BlobCounter();

            bblob.ObjectsOrder = ObjectsOrder.Area;
            bblob.ProcessImage(bimage);

            Rectangle[] rrect = rblob.GetObjectsRectangles();
            Rectangle[] brect = bblob.GetObjectsRectangles();

            p   = new int[rrect.Length + brect.Length];
            arr = 0;
            if (rrect.Length > 0)
            {
                for (int i = 0; i < rrect.Length; i++)
                {
                    if (rrect[i].Height > 20 && rrect[i].Width > 20)//Object Min height width
                    {
                        Graphics g = Graphics.FromImage(realimage);
                        g.DrawRectangle(new Pen(Color.Red), rrect[i]);
                        objheight = rrect[i].Height;
                        objwidth  = rrect[i].Width;
                        objx      = rrect[i].X + (objwidth / 2);
                        objy      = rrect[i].Y + (objheight / 2);
                        p[i]      = getpartition();
                        arr++;
                        g.DrawEllipse(new Pen(Color.Yellow), objx, objy, 5, 5);
                        g.DrawString("Red Object", new Font("Arial", 10), new SolidBrush(Color.AntiqueWhite), objx, objy - 15);
                        g.DrawString("X:" + objx + "  Y:" + objy, new Font("Arial", 10), new SolidBrush(Color.LimeGreen), objx, objy);
                        g.DrawString("H:" + objheight + "  W:" + objwidth, new Font("Arial", 10), new SolidBrush(Color.LightCyan), objx, objy + 15);
                        g.DrawString("P:" + p[i], new Font("Arial", 10), new SolidBrush(Color.LightSkyBlue), objx, objy + 25);
                    }
                }


                obj = largest();
                if (obj == 0)
                {
                    obj = prevobj;
                }
                prevobj = obj;
            }

            if (brect.Length > 0)
            {
                for (int i = 0; i < brect.Length; i++)
                {
                    if (brect[i].Height > 20 && brect[i].Width > 20)//Object Min height width
                    {
                        Graphics g = Graphics.FromImage(realimage);
                        g.DrawRectangle(new Pen(Color.Red), brect[i]);
                        objheight  = brect[i].Height;
                        objwidth   = brect[i].Width;
                        objx       = brect[i].X + (objwidth / 2);
                        objy       = brect[i].Y + (objheight / 2);
                        p[i + arr] = getpartition();
                        g.DrawEllipse(new Pen(Color.Yellow), objx, objy, 5, 5);
                        g.DrawString("Blue Object", new Font("Arial", 10), new SolidBrush(Color.AntiqueWhite), objx, objy - 15);
                        g.DrawString("X:" + objx + "  Y:" + objy, new Font("Arial", 10), new SolidBrush(Color.LimeGreen), objx, objy);
                        g.DrawString("H:" + objheight + "  W:" + objwidth, new Font("Arial", 10), new SolidBrush(Color.LightCyan), objx, objy + 15);
                        g.DrawString("P:" + p[i + arr], new Font("Arial", 10), new SolidBrush(Color.LightSkyBlue), objx, objy + 25);
                    }
                }

                obj = largest();
                if (obj == 0)
                {
                    obj = prevobj;
                }
                prevobj = obj;
            }



            displayBox.Image = realimage;
        }
Example #18
0
        public void Video_NewFrame(object sender, NewFrameEventArgs eventArgs)
        {
            UnmanagedImage image = UnmanagedImage.FromManagedImage((Bitmap)eventArgs.Frame.Clone());

            var            extractChannel = new ExtractChannel(RGB.R);
            UnmanagedImage channel        = extractChannel.Apply(image);

            //		UnmanagedImage originalRed = channel.Clone();
            if (true)
            {
                var threshold = new Threshold(200);
                threshold.ApplyInPlace(channel);

                ////filter to convert RGB image to 8bpp gray scale for image processing
                //IFilter gray_filter = new GrayscaleBT709();
                //gray_image = gray_filter.Apply(gray_image);

                ////thresholding a image
                //Threshold th_filter = new Threshold(color_data.threshold);
                //th_filter.ApplyInPlace(gray_image);

                //erosion filter to filter out small unwanted pixels
                Erosion3x3 erosion = new Erosion3x3();
                erosion.ApplyInPlace(channel);

                //dilation filter
                //Dilatation3x3 dilatation = new Dilatation3x3();
                //dilatation.ApplyInPlace(channel);

                //GrayscaleToRGB filter = new GrayscaleToRGB();
                //image = filter.Apply(channel);

                //ReplaceChannel replaceFilter = new ReplaceChannel(RGB.B, channel);
                //replaceFilter.ApplyInPlace(image);
            }

            BlobCounter bc = new BlobCounter();

            //arrange blobs by area
            bc.ObjectsOrder = ObjectsOrder.Area;
            bc.FilterBlobs  = true;
            bc.MinHeight    = minObjectSize;
            bc.MinWidth     = minObjectSize;
            bc.MaxHeight    = maxObjectSize;
            bc.MaxWidth     = maxObjectSize;

            //process image for blobs
            bc.ProcessImage(channel);
            channel.Dispose();

            //	if (motionDetector.ProcessFrame(image) > 0.02) {
            //	for (int i = 0; i < blobCountingObjectsProcessing.ObjectRectangles.Length; i++) {
            Rectangle[] rectangles = bc.GetObjectsRectangles();
            Blob[]      blobs      = bc.GetObjectsInformation();
            for (int i = 0; i < bc.ObjectsCount; i++)
            {
                Rectangle rectangle = rectangles[i];
                int       width     = rectangle.Width;
                int       height    = rectangle.Height;

                //		if (width < maxObjectSize && height < maxObjectSize && width > minObjectSize && height > minObjectSize) {
                Drawing.Rectangle(image, rectangle, colorList[i % colorList.Length]);

                if (i == 0)
                {
                    Position = GetCenterOfMass(image, rectangle);
                    Drawing.FillRectangle(image, rectangle, Color.BlanchedAlmond);
                    Drawing.FillRectangle(image, new Rectangle((int)Position.U - dotSize, (int)Position.V - dotSize, dotSize * 3, dotSize * 3), Color.Indigo);
                }
                //		}
            }
            //	}

            Image = image.ToManagedImage();
            //	videoForm.ImageDestination.Image = image.ToManagedImage();
        }
Example #19
0
        private static WavechartBox show(String title, bool hold, params Tuple <Signal, int>[] series)
        {
            WavechartBox form       = null;
            Thread       formThread = null;

            AutoResetEvent stopWaitHandle = new AutoResetEvent(false);

            formThread = new Thread(() =>
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);

                // Show control in a form
                form            = new WavechartBox();
                form.Text       = title;
                form.formThread = formThread;

                if (!String.IsNullOrEmpty(title))
                {
                    form.zedGraphControl.GraphPane.Title.IsVisible = true;
                    form.zedGraphControl.GraphPane.Title.Text      = title;
                }

                var sequence = new ColorSequenceCollection(series.Length);

                for (int i = 0; i < series.Length; i++)
                {
                    var signal  = series[i].Item1;
                    int channel = series[i].Item2;

                    ComplexSignal complex = signal as ComplexSignal;

                    if (complex != null && complex.Status != ComplexSignalStatus.Normal)
                    {
                        double[] spectrum    = Accord.Audio.Tools.GetPowerSpectrum(complex.GetChannel(channel));
                        double[] frequencies = Accord.Audio.Tools.GetFrequencyVector(signal.Length, signal.SampleRate);

                        form.series.Add(new LineItem(i.ToString(), frequencies,
                                                     spectrum, sequence.GetColor(i), SymbolType.None));

                        form.zedGraphControl.GraphPane.XAxis.Title.Text = "Frequency";
                        form.zedGraphControl.GraphPane.YAxis.Title.Text = "Power";
                    }
                    else
                    {
                        double[] values;
                        if (signal.Channels == 1)
                        {
                            values = signal.ToDouble();
                        }
                        else
                        {
                            ExtractChannel extract = new ExtractChannel(channel);
                            values = extract.Apply(signal).ToDouble();
                        }

                        form.series.Add(new LineItem(i.ToString(), Matrix.Indices(0, signal.Length).ToDouble(),
                                                     values, sequence.GetColor(i), SymbolType.None));

                        form.zedGraphControl.GraphPane.XAxis.Title.Text = "Time";
                        form.zedGraphControl.GraphPane.YAxis.Title.Text = "Amplitude";
                    }
                }

                form.zedGraphControl.GraphPane.AxisChange();

                stopWaitHandle.Set();

                Application.Run(form);
            });

            formThread.SetApartmentState(ApartmentState.STA);

            formThread.Start();

            stopWaitHandle.WaitOne();

            if (!hold)
            {
                formThread.Join();
            }

            return(form);
        }
Example #20
0
        public Bitmap ExtractChannelFilter(Bitmap img)
        {
            ExtractChannel filter = new ExtractChannel(AForge.Imaging.RGB.G);

            return(filter.Apply(img));
        }