ConvertTOGrayScale() public method

public ConvertTOGrayScale ( double cr, double cg, double cb ) : Bitmap
cr double
cg double
cb double
return System.Drawing.Bitmap
Beispiel #1
0
        static void Main(string[] args)
        {
            string imagepath = Directory.GetCurrentDirectory() + @"\Data";
            ImageProcessor imgProcessor = new ImageProcessor(new Bitmap(imagepath + @"\GoogleSample.jpg"));
            imgProcessor.ConvertTOGrayScale(0.2125, 0.7154, 0.0721);
            imgProcessor.ImageBitmap.Save(Directory.GetCurrentDirectory() + @"\Output\" + "test.bmp");
            imgProcessor.BinarizeImage(100);
            imgProcessor.ImageBitmap.Save(Directory.GetCurrentDirectory() + @"\Output\" + "test2.bmp");
            List<Blob> blobs = imgProcessor.ExtractBlob();
            imgProcessor.SaveBlobsToLocal(Directory.GetCurrentDirectory() + @"\Output\", imgProcessor.ExtractBlob());

            
            blobs.ForEach(blob => 
            {
                List<Rectangle> rectangles = imgProcessor.GetBlobRectangles(blob);
                
                foreach(Rectangle rect in rectangles)
                {
                    Highlight(rect);
                }
                
            });
            

            //Bitmap bmp1 = new Bitmap(imagepath + @"\Graph.png");
            //Bitmap grayImage = blob.ConvertTOGrayScale(0.2125, 0.7154, 0.0721, bmp1);
            ////grayImage.Save(Directory.GetCurrentDirectory() + @"\Output\" + "test.bmp");
            //Bitmap binarizedImage = blob.BinarizeImage(100, grayImage);
            ////binarizedImage.Save(Directory.GetCurrentDirectory() + @"\Output\" + "test2.bmp");

            //ImageProcessor blob2 = new ImageProcessor(binarizedImage);
            //var test2 = blob2.ExtractBlob(55, 130,0,0);
            //blob2.SaveBlobsToLocal(Directory.GetCurrentDirectory() + @"\Output", test2);
        }