0
Answer

Image Processing: Redraw the outline of any image (sketching) in C#.Net, but How??

Ask a question

Hi,

For convert the any image into sketch format (draw just the dark pixels),I use following logic:

for (int i = 0; i < 300; i++)

            {

                for (int j = 0; j < 200; j++)

                {               

                        p = new Pen(bitmap.GetPixel(i, j), 1);//get pixel from the image/bitmap

                        for (int r1 = 0; r1 < 100; r1++)

                        {

                            for (int r2 =0; r2 < 100; r2++)

                            {

                                for (int r3 = 0; r3 < 100; r3++)

                                {

                                    if (p.Color ! = Color.FromArgb(255, r1, r2, r3)) //check dark pixel

                                    {

                                        p.Color = Color.Transparent;

                                     }

                                         g.DrawRectangle(p, 1 * i, 1 * j, 1, 1);

                                }

                            }

                        }

 

But it is too slow and not efficient ………Is above code require more betterment (if required then tell me what things are requried)or it is totally wrong?………second question is that  Am I convert the color picture into the grayscale format by using the built-in function in Visual Studio C-Sharp .Net (if anyone function/class is present then tell me)  -or-  it need a algorithm and has a lengthy processes =>please give the some hints about the image processing.

Please send your logic for conversion of any image into sketch style.

Thanks…