public static Bitmap Blur(Bitmap bmp)
        {
            // create filter
            Blur filter = new Blur();

            // apply the filter
            filter.ApplyInPlace(bmp);
            return(bmp);
        }
Beispiel #2
0
        private void blurToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (checkifthereisimage() != 1)
            {
                return;
            }
            Blur filter = new Blur();

            filter.ApplyInPlace((Bitmap)pictureBox1ImagePreview.Image);
            pictureBox1ImagePreview.Refresh();
            pictureBox1ImagePreview.Update();
        }
        // This function will get triggered/executed when a new message is written
        // on an Azure Queue called queue.
        public static void ProcessQueueMessage([QueueTrigger("imagemessagequeue")] string message,
                                               [Blob("blobcontainer/{queueTrigger}", FileAccess.Read)] Stream myBlob,
                                               [Blob("blobcontainer/{queueTrigger}", FileAccess.Write)] Stream outBlob,
                                               TextWriter log)
        {
            Blur filter = new Blur();

            Bitmap bitmap = new Bitmap(myBlob);

            ImageFormat imageFormat = bitmap.RawFormat;

            filter.ApplyInPlace(bitmap);

            bitmap.Save(outBlob, imageFormat);
        }
Beispiel #4
0
        // This function will get triggered/executed when a new message is written
        // on an Azure Queue called queue.
        public static void ProcessQueueMessage([QueueTrigger("messages-queue")] string message,
                                               [Blob("images-container/{queueTrigger}", FileAccess.Read)] Stream readStream,
                                               [Blob("images-container/{queueTrigger}", FileAccess.Write)] Stream writeStream, TextWriter log)
        {
            Bitmap bitmap = new Bitmap(readStream);

            Blur filter = new Blur();

            ImageFormat imageFormat = bitmap.RawFormat;

            filter.ApplyInPlace(bitmap);

            bitmap.Save(writeStream, imageFormat);

            log.WriteLine(message);
        }
Beispiel #5
0
        void BlurToolStripMenuItemClick(object sender, EventArgs e)
        {
            //jika gambar kosong/null maka akan mengembalikan nilai kosong/null
            if (gambar == null)
            {
                return;
            }
            //membuat filter dari inisiasi class Blur() pada objek blur
            Blur blur = new Blur( );

            //clone variable gambar pada variable gambar2
            gambar2 = (Bitmap)gambar.Clone();
            //aplikasikan filter objek blur pada gambar2
            blur.ApplyInPlace(gambar2);
            //tampilkan hasil gambar2 yang sudah diaplikasikan filter pada pictureBox2
            pictureBox2.Image = gambar2;
        }
        public void HughCircleTransform()
        {
            Grayscale filterGrayscale = new Grayscale(0.2125, 0.7154, 0.0721);

            ImageBitmap8pp = filterGrayscale.Apply(ImageBitmap);

            Blur filterBlur = new Blur();

            filterBlur.ApplyInPlace(ImageBitmap8pp);

            //ContrastStretch filterContrast = new ContrastStretch();
            //filterContrast.ApplyInPlace(ImageBitmap8pp);

            ImageBitmap8pp.Save("test0.bmp");

            CannyEdgeDetector filter = new CannyEdgeDetector();

            filter.ApplyInPlace(ImageBitmap8pp);

            HoughCircleTransformation circleTransform = new HoughCircleTransformation(35);

            circleTransform.LocalPeakRadius = 300;
            circleTransform.ProcessImage(ImageBitmap8pp);
            Bitmap houghCirlceImage = circleTransform.ToBitmap();

            HoughCircle[] circles = circleTransform.GetCirclesByRelativeIntensity(0.6);

            foreach (HoughCircle circle in circles)
            {
                Pen redPen = new Pen(System.Drawing.Color.Red, 3);
                using (var graphics = Graphics.FromImage(ImageBitmap))
                {
                    graphics.DrawEllipse(redPen, circle.X - circle.Radius, circle.Y - circle.Radius, circle.Radius * 2, circle.Radius * 2);
                }
            }

            ImageBitmap8pp.Save("test1.bmp");
            houghCirlceImage.Save("test2.bmp");
            ImageBitmap.Save("test3.bmp");
        }
Beispiel #7
0
        public static Tuple <Bitmap, double, Rectangle> smate_rotate(Bitmap src)
        {
            Bitmap        retB     = null;
            Rectangle     retR     = Rectangle.Empty;
            double        retAngle = 90.0;
            double        angle    = 0.0;
            RotateBicubic filter   = new RotateBicubic(retAngle);
            Bitmap        src1     = filter.Apply(src);
            //Bitmap src1 = (Bitmap)src.Clone();
            Bitmap g  = Grayscale.CommonAlgorithms.BT709.Apply(src1);
            Invert it = new Invert();

            it.ApplyInPlace(g);
            //g.Save("temp_1.jpg");
            ImageStatistics stat = new ImageStatistics(g);
            Threshold       t    = new Threshold((int)(stat.Gray.Mean - stat.Gray.StdDev));

            t.ApplyInPlace(g);
            //g.Save("temp_2.jpg");
            stat = new ImageStatistics(g);
            DifferenceEdgeDetector edgeDetector = new DifferenceEdgeDetector();

            edgeDetector.ApplyInPlace(g);
            //g.Save("temp_3.jpg");
            HoughLineTransformation lineTransform = new HoughLineTransformation();

            lineTransform.ProcessImage(g);
            HoughLine[] lines = lineTransform.GetLinesByRelativeIntensity(0.8);
            foreach (HoughLine l in lines)
            {
                Program.logIt(string.Format("Intensity={0}, Radius={1}, Theta={2}", l.Intensity, l.Radius, l.Theta));
                if (l.Radius < 0)
                {
                    if (l.Theta < 90)
                    {
                        angle = -l.Theta;
                    }
                    else
                    {
                        angle = 180.0 - l.Theta;
                    }
                }
                else
                {
                    if (l.Theta < 90)
                    {
                        angle = -l.Theta;
                    }
                    else
                    {
                        angle = 180.0 - l.Theta;
                    }
                }
                if (Math.Abs(angle) < 45.0)
                {
                    break;
                }
            }
            Program.logIt(string.Format("angle={0}", angle));
            retAngle += angle;
            RotateBicubic r_filter = new RotateBicubic(angle);
            Bitmap        rotated  = r_filter.Apply(src1);

            // crop
            if (rotated != null)
            {
                Grayscale g_filter  = new Grayscale(0.2125, 0.7154, 0.0721);
                Bitmap    grayImage = g_filter.Apply(rotated);
                Blur      bf        = new Blur();
                bf.ApplyInPlace(grayImage);
                OtsuThreshold o_filter = new OtsuThreshold();
                o_filter.ApplyInPlace(grayImage);
                BlobCounter blobCounter = new BlobCounter();
                blobCounter.MinHeight    = 20;
                blobCounter.MinWidth     = 20;
                blobCounter.FilterBlobs  = false;
                blobCounter.BlobsFilter  = null;
                blobCounter.ObjectsOrder = ObjectsOrder.YX;
                blobCounter.ProcessImage(grayImage);
                Blob[] blobs = blobCounter.GetObjectsInformation();
                Program.logIt(string.Format("blobs={0}", blobCounter.ObjectsCount));
                Rectangle r = Rectangle.Empty;
                for (int i = 1; i < blobs.Length; i++)
                {
                    Blob b = blobs[i];
                    Program.logIt(string.Format("{0}: {1}", b.ID, b.Rectangle));
                    if (r == Rectangle.Empty)
                    {
                        r = b.Rectangle;
                    }
                    else
                    {
                        r = Rectangle.Union(r, b.Rectangle);
                    }
                }
                Program.logIt(string.Format("rect: {0}", r));
                retR = r;
                Crop c_filter = new Crop(r);
                retB = c_filter.Apply(rotated);
            }
            return(new Tuple <Bitmap, double, Rectangle>(retB, retAngle, retR));
        }
Beispiel #8
0
        public static Image ApplyImageProperties(byte[] blobContent, ImageProperties properties)
        {
            Bitmap image = null;

            try {
                using (var ms = new MemoryStream(blobContent)) {
                    image = (Bitmap)System.Drawing.Image.FromStream(ms, false, false);
                    image = AForge.Imaging.Image.Clone(image, PixelFormat.Format24bppRgb);
                    if (properties.Crop != null)
                    {
                        AForge.Imaging.Filters.Crop filter = new AForge.Imaging.Filters.Crop(new Rectangle(properties.Crop.XOffset, properties.Crop.YOffset, properties.Crop.CropWidth, properties.Crop.CropHeight));
                        image = filter.Apply(image);
                    }
                    if (properties.ImageWidth != properties.OriginalWidth || properties.ImageHeight != properties.OriginalHeight)
                    {
                        var filter = new ResizeBicubic(properties.ImageWidth, properties.ImageHeight);
                        image = filter.Apply(image);
                    }
                    if (properties.Colors != null)
                    {
                        if (properties.Colors.TransparentColor != null)
                        {
                            image.MakeTransparent(ColorTranslator.FromHtml("#" + properties.Colors.TransparentColor));
                        }
                        var brightness = properties.Colors.Brightness;
                        var bfilter    = new BrightnessCorrection(brightness);
                        bfilter.ApplyInPlace(image);
                        var contrast = properties.Colors.Contrast;
                        var cfilter  = new ContrastCorrection(contrast);
                        cfilter.ApplyInPlace(image);
                        if (properties.Colors.Hue != 0)
                        {
                            var         hue    = properties.Colors.Hue;
                            HueModifier filter = new HueModifier(hue);
                            filter.ApplyInPlace(image);
                        }
                        var saturation = properties.Colors.Saturation;
                        var sfilter    = new SaturationCorrection(saturation * 0.01f);
                        sfilter.ApplyInPlace(image);
                    }
                    # region Effects
                    if (!String.IsNullOrEmpty(properties.Effects))
                    {
                        var effects = properties.Effects.Split(';');
                        foreach (var item in effects)
                        {
                            switch (item)
                            {
                            case "Grayscale":
                                var g = new Grayscale(0.2125, 0.7154, 0.0721);
                                image = g.Apply(image);
                                break;

                            case "Sepia":
                                var s = new Sepia();
                                image = AForge.Imaging.Image.Clone(image, PixelFormat.Format24bppRgb);
                                s.ApplyInPlace(image);
                                break;

                            case "Rotate Channels":
                                image = AForge.Imaging.Image.Clone(image, PixelFormat.Format24bppRgb);
                                var r = new RotateChannels();
                                r.ApplyInPlace(image);
                                break;

                            case "Invert":
                                var i = new Invert();
                                i.ApplyInPlace(image);
                                break;

                            case "Blur":
                                var b = new Blur();
                                b.ApplyInPlace(image);
                                break;

                            case "Gaussian Blur":
                                var gb = new GaussianBlur(4, 11);
                                gb.ApplyInPlace(image);
                                break;

                            case "Convolution":
                                int[,] kernel = { { -2, -1, 0 }, { -1, 1, 1 }, { 0, 1, 2 } };
                                var c = new Convolution(kernel);
                                c.ApplyInPlace(image);
                                break;

                            case "Edges":
                                var e = new Edges();
                                e.ApplyInPlace(image);
                                break;
                            }
                        }
                    }
                    # endregion
                }
            } catch (Exception) {
Beispiel #9
0
        private void btn_search_Click(object sender, EventArgs e)
        {
            //bright = 0;
            //  value = 10;

            openFileDialog1.Title  = "영상파일 열기";
            openFileDialog1.Filter = "All Files(*.*)|*.*| Bitmap File(*.bmp)|*.bmp|GIF File(*.gif)|*.gif|JPEG File(*.jpg)|*.jpg|PNG file(*.png)|*.png|TIFF(*.tif)|*.tif";

            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                openstrFilename         = openFileDialog1.FileName;
                image                   = System.Drawing.Image.FromFile(openstrFilename);
                myBitmap                = new Bitmap(image);
                this.xray_preview.Image = myBitmap;// 원 이미지를 담는 PictureBox 개체
            }

            //임시화일삭제
            string   filePath = @"Image\temp.jpg";
            FileInfo file     = new FileInfo(filePath);

            if (file.Exists)
            {
                file.Delete();
            }

            /*
             *손바닥 외곽선 추출
             */
            Bitmap CroppedImage = myBitmap.Clone(new System.Drawing.Rectangle(0, 100, myBitmap.Width, (myBitmap.Height - 100)), myBitmap.PixelFormat); //손바닥
            int    width        = 600;
            int    height       = 600;
            Size   resize       = new Size(width, height);

            resizeImage = new Bitmap(CroppedImage, resize);

            gsImage = Grayscale.CommonAlgorithms.BT709.Apply(resizeImage);
            filter  = new CannyEdgeDetector();
            edge    = filter.Apply(gsImage);


            //외곽선 블러링
            Blur hfilter = new Blur();

            // apply the filter
            hfilter.ApplyInPlace(edge);

            ///////////////////////////
            // process image with blob counter
            BlobCounter hblobCounter = new BlobCounter();

            hblobCounter.ProcessImage(edge);
            Blob[] hblobs = hblobCounter.GetObjectsInformation();

            // create convex hull searching algorithm
            GrahamConvexHull hhullFinder = new GrahamConvexHull();

            // lock image to draw on it
            BitmapData hdata = edge.LockBits(new Rectangle(0, 0, edge.Width, edge.Height), ImageLockMode.ReadWrite, edge.PixelFormat);

            // process each blob
            List <IntPoint> hhull       = new List <IntPoint> {
            };
            List <IntPoint> hedgePoints = new List <IntPoint> {
            };
            int hblobcount = 0;
            int hminX = 0, hmaxX = 700, hminY = 0, hmaxY = 700;

            foreach (Blob blob in hblobs)
            {
                List <IntPoint> leftPoints, rightPoints;
                // get blob's edge points
                hblobCounter.GetBlobsLeftAndRightEdges(blob, out leftPoints, out rightPoints);

                hedgePoints.AddRange(leftPoints);
                hedgePoints.AddRange(rightPoints);

                // blob's convex hull
                hhull = hhullFinder.FindHull(hedgePoints);

                foreach (IntPoint hulls in hhull)
                { // convexhull 최외곽선 추출
                    if (hblobcount == 0)
                    {
                        hminX = hulls.X; hmaxX = hulls.X;
                        hminY = hulls.Y; hmaxY = hulls.Y;
                    }

                    if (hminX > hulls.X)
                    {
                        hminX = hulls.X;
                    }
                    else if (hmaxX < hulls.X)
                    {
                        hmaxX = hulls.X;
                    }

                    if (hminY > hulls.Y)
                    {
                        hminY = hulls.Y;
                    }
                    else if (hmaxY < hulls.Y)
                    {
                        hmaxY = hulls.Y;
                    }
                    hblobcount++;
                }
                Drawing.Polygon(hdata, hhull, Color.White);
            }

            edge = edge.Clone(new Rectangle(hminX, hminY, hmaxX - hminX, hmaxY - hminY), myBitmap.PixelFormat);
            this.xray_preview.Image = edge;


            ///////////////////////////////////
            //수골 및 지골 분할 및 특징 추출
            //손목 : 요골 및 척골 (2곳)
            //손바닥 : 제1,3,5지 중수골 (3곳)
            //손가락 : 제1,3,5지 기절골 및 말절골 (6곳)
            //손가락 : 제3. 5지 중수골 (2곳)
            ///////////////////////////////

            //요골 추출 및 인지 알고리즘
            CroppedImage1 = myBitmap.Clone(new System.Drawing.Rectangle(270, 620, 250, 180), myBitmap.PixelFormat); //1. 요골

            //이미지 사이즈 정규화 요골 크롭 이미지 250 X 180 -> 125 X 125
            CroppedImage1 = CroppedImage1.Clone(new System.Drawing.Rectangle(10, 0, 230, 150), myBitmap.PixelFormat);
            width         = 125;
            height        = 125;
            resize        = new Size(width, height);
            resizeImage   = new Bitmap(CroppedImage1, resize);

            //전처리 및 특징 추출 루틴
            //DetectCorners(CroppedImage1);
            gsImage = Grayscale.CommonAlgorithms.BT709.Apply(resizeImage);
            filter  = new CannyEdgeDetector();
            edge    = filter.Apply(gsImage);

            //외곽선 블러링
            Blur Bfilter = new Blur();

            // apply the filter
            Bfilter.ApplyInPlace(edge);

            ///////////////////////////
            // process image with blob counter
            BlobCounter blobCounter = new BlobCounter();

            blobCounter.ProcessImage(edge);
            Blob[] blobs = blobCounter.GetObjectsInformation();

            // create convex hull searching algorithm
            GrahamConvexHull hullFinder = new GrahamConvexHull();

            // lock image to draw on it
            BitmapData data = edge.LockBits(new Rectangle(0, 0, edge.Width, edge.Height), ImageLockMode.ReadWrite, edge.PixelFormat);

            // process each blob
            List <IntPoint> hull       = new List <IntPoint> {
            };
            List <IntPoint> edgePoints = new List <IntPoint> {
            };
            int blobcount = 0;
            int minX = 0, maxX = 125, minY = 0, maxY = 125;

            foreach (Blob blob in blobs)
            {
                List <IntPoint> leftPoints, rightPoints;
                // get blob's edge points
                blobCounter.GetBlobsLeftAndRightEdges(blob, out leftPoints, out rightPoints);

                edgePoints.AddRange(leftPoints);
                edgePoints.AddRange(rightPoints);

                // blob's convex hull
                hull = hullFinder.FindHull(edgePoints);

                foreach (IntPoint hulls in hull)   // convexhull 최외곽선 추출
                {
                    if (blobcount == 0)
                    {
                        minX = hulls.X; maxX = hulls.X;
                        minY = hulls.Y; maxY = hulls.Y;
                    }
                    if (minX > hulls.X)
                    {
                        minX = hulls.X;
                    }
                    else if (maxX < hulls.X)
                    {
                        maxX = hulls.X;
                    }

                    if (minY > hulls.Y)
                    {
                        minY = hulls.Y;
                    }
                    else if (maxY < hulls.Y)
                    {
                        maxY = hulls.Y;
                    }
                    blobcount++;
                }
                Drawing.Polygon(data, hull, Color.White);
            }

            edge = resizeImage.Clone(new System.Drawing.Rectangle(minX, minY, maxX - minX, maxY - minY), myBitmap.PixelFormat);
            CroppedImage1.Save(@"Image\temp.jpg", ImageFormat.Jpeg);
            this.pB_radius.Image = edge;
            /////////////////////////////////////////////////////////////


            ////////////////////////
            //척골
            //////////////
            CroppedImage2 = myBitmap.Clone(new System.Drawing.Rectangle(133, 620, 200, 180), myBitmap.PixelFormat); //2. 척골
                                                                                                                    //이미지 사이즈 정규화 요골 크롭 이미지 250 X 180 -> 125 X 125
            CroppedImage2 = CroppedImage2.Clone(new System.Drawing.Rectangle(0, 20, 200, 150), myBitmap.PixelFormat);
            width         = 125;
            height        = 125;
            resize        = new Size(width, height);
            resizeImage   = new Bitmap(CroppedImage2, resize);

            //전처리 및 특징 추출 루틴
            //DetectCorners(CroppedImage1);
            gsImage = Grayscale.CommonAlgorithms.BT709.Apply(resizeImage);
            filter  = new CannyEdgeDetector();
            edge    = filter.Apply(gsImage);

            //외곽선 블러링
            Bfilter = new Blur();
            // apply the filter
            Bfilter.ApplyInPlace(edge);

            ///////////////////////////
            // process image with blob counter
            blobCounter = new BlobCounter();
            blobCounter.ProcessImage(edge);
            blobs = blobCounter.GetObjectsInformation();

            // create convex hull searching algorithm
            hullFinder = new GrahamConvexHull();

            // lock image to draw on it
            BitmapData data1 = edge.LockBits(new Rectangle(0, 0, edge.Width, edge.Height), ImageLockMode.ReadWrite, edge.PixelFormat);

            // process each blob
            hull       = new List <IntPoint> {
            };
            edgePoints = new List <IntPoint> {
            };
            blobcount  = 0;
            minX       = 0; maxX = 125; minY = 0; maxY = 125;
            foreach (Blob blob in blobs)
            {
                List <IntPoint> leftPoints, rightPoints;
                // get blob's edge points
                blobCounter.GetBlobsLeftAndRightEdges(blob, out leftPoints, out rightPoints);

                edgePoints.AddRange(leftPoints);
                edgePoints.AddRange(rightPoints);

                // blob's convex hull
                hull = hullFinder.FindHull(edgePoints);

                foreach (IntPoint hulls in hull)
                { // convexhull 최외곽선 추출
                    if (blobcount == 0)
                    {
                        minX = hulls.X; maxX = hulls.X;
                        minY = hulls.Y; maxY = hulls.Y;
                    }
                    if (minX > hulls.X)
                    {
                        minX = hulls.X;
                    }
                    else if (maxX < hulls.X)
                    {
                        maxX = hulls.X;
                    }

                    if (minY > hulls.Y)
                    {
                        minY = hulls.Y;
                    }
                    else if (maxY < hulls.Y)
                    {
                        maxY = hulls.Y;
                    }
                    blobcount++;
                }
                Drawing.Polygon(data1, hull, Color.White);
            }
            Bitmap edge1 = resizeImage.Clone(new System.Drawing.Rectangle(minX, minY, (maxX - minX), (maxY - minY)), myBitmap.PixelFormat);

            this.pB_ulna.Image = edge1;
            ///////////////////////////////////////


            CroppedImage3      = myBitmap.Clone(new System.Drawing.Rectangle(390, 500, 180, 180), myBitmap.PixelFormat); //3. 제1지 중수골
            resizeImage        = new Bitmap(CroppedImage3, resize);
            this.pB_Met1.Image = CroppedImage3;

            CroppedImage4      = myBitmap.Clone(new System.Drawing.Rectangle(266, 266, 180, 180), myBitmap.PixelFormat); //4.제3지 기절골/중절골
            resizeImage        = new Bitmap(CroppedImage4, resize);
            this.pB_Met3.Image = CroppedImage4;

            CroppedImage5      = myBitmap.Clone(new System.Drawing.Rectangle(75, 335, 180, 180), myBitmap.PixelFormat); //5. 제5지 중수골/기절골
            resizeImage        = new Bitmap(CroppedImage5, resize);
            this.pB_Met5.Image = CroppedImage5;

            CroppedImage6      = myBitmap.Clone(new System.Drawing.Rectangle(534, 410, 180, 180), myBitmap.PixelFormat); //6. 제1지 기절골
            resizeImage        = new Bitmap(CroppedImage6, resize);
            this.pB_Pph1.Image = CroppedImage6;

            CroppedImage7      = myBitmap.Clone(new System.Drawing.Rectangle(266, 266, 180, 180), myBitmap.PixelFormat); //7. 제3지 기절골/중절골
            resizeImage        = new Bitmap(CroppedImage7, resize);
            this.pB_Pph3.Image = CroppedImage7;

            CroppedImage8      = myBitmap.Clone(new System.Drawing.Rectangle(75, 335, 180, 180), myBitmap.PixelFormat); //8. 제5지 중수골/기절골
            resizeImage        = new Bitmap(CroppedImage8, resize);
            this.pB_Pph5.Image = CroppedImage8;

            CroppedImage9      = myBitmap.Clone(new System.Drawing.Rectangle(260, 110, 180, 180), myBitmap.PixelFormat); //9. 제3자 중절골
            resizeImage        = new Bitmap(CroppedImage9, resize);
            this.pB_Mph3.Image = CroppedImage9;

            CroppedImage10     = myBitmap.Clone(new System.Drawing.Rectangle(0, 250, 180, 180), myBitmap.PixelFormat); //10. 제5지 중절골
            resizeImage        = new Bitmap(CroppedImage10, resize);
            this.pB_Mph5.Image = CroppedImage10;

            CroppedImage11     = myBitmap.Clone(new System.Drawing.Rectangle(620, 320, 180, 180), myBitmap.PixelFormat); //11. 제1지 말절골
            resizeImage        = new Bitmap(CroppedImage11, resize);
            this.pB_Dph1.Image = CroppedImage11;

            CroppedImage12     = myBitmap.Clone(new System.Drawing.Rectangle(260, 0, 180, 180), myBitmap.PixelFormat); //12. 제3지 말절골
            resizeImage        = new Bitmap(CroppedImage12, resize);
            this.pB_Dph3.Image = CroppedImage12;

            CroppedImage13     = myBitmap.Clone(new System.Drawing.Rectangle(0, 133, 180, 180), myBitmap.PixelFormat); //13. 제5지 말절골
            resizeImage        = new Bitmap(CroppedImage13, resize);
            this.pB_Dph5.Image = CroppedImage13;

            //edge.UnlockBits(data1);
            //edge.UnlockBits(data);
        }