AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

Graphic Point Finding & Drawing

The forum is to discuss topics related to different areas of image processing and computer vision.

Graphic Point Finding & Drawing

Postby piausuk » Wed Apr 20, 2011 4:21 am

Hi, Expert.

I'm now trying to do a project which is image comparison and find out the difference.
For the difference, I would like to draw out i circle to show to the user.

Untitled.jpg
Finding difference
Untitled.jpg (148.96 KiB) Viewed 919 times

The problem i faced was:
* I cannot get & draw out the difference point between both Master image (img1) and SAMPLE image (img2)
* For my result, I would like to draw out the circle based on the MASTER image position in any color inside the Yellow Rectangle (draw by me using paint) for SAMPLE image.

Currently, I have do by overlay technique but not the result i wanted, which is:
Code: Select all
                    ThresholdedDifference filter = new ThresholdedDifference(100);
                    filter.OverlayImage = img2;
                    Bitmap resultImage = filter.Apply(img1);
                    resultImage.MakeTransparent();

                    Bitmap bitmapResult = new Bitmap(img2.Width, img2.Height, img2.PixelFormat);
                    Graphics g = Graphics.FromImage(bitmapResult);
                    g.DrawImage(img2, 0, 0, img1.Width, img1.Height); //background image
                    g.DrawImage(resultImage, 0, 0, img1.Width, img1.Height); //foreground image
                    g.Save();

                    pictureBox2.Image = bitmapResult;


Untitled2.jpg
result of finding
Untitled2.jpg (147.29 KiB) Viewed 919 times

* This is trying to overlay the SAMPLE image by using the difference of both image.
* The result will be in the Yellow Rectangle(draw by paint) of SAMPLE image(img2).
* If possible, I would like to change the differences color (inside the SAMPLE image - white color) during the .MakeTransparent() method into other color so that it will directly so the different. (for me, this is the most simplest way to do the comparison.)

At last, thanks for you view and if possible, please guide me or given me any suggestion to do that... ^.^
piausuk
 
Posts: 15
Joined: Sun Apr 17, 2011 3:16 pm

Re: Graphic Point Finding & Drawing

Postby andrew.kirillov » Wed Apr 20, 2011 8:29 am

Hello,

If you need to draw something on an image, you may use standard .NET class - Graphics. Just use Graphics.FromImage() and then draw with it.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 2583
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: Graphic Point Finding & Drawing

Postby piausuk » Wed Apr 20, 2011 9:37 am

Dear Andrew,

Thanks for you suggestion, but the thing is how can i store the position of the differences for both image in order to use for drawing?

PS
piausuk
 
Posts: 15
Joined: Sun Apr 17, 2011 3:16 pm

Re: Graphic Point Finding & Drawing

Postby andrew.kirillov » Wed Apr 20, 2011 11:19 am

Well, if you can build AForge.Imaging.dll from current sources in trunk, you will find there a new method, which is UnmanagedImage.CollectActivePixels() - collects coordinates of none black pixels in the image. Otherwise you will need to wait for release or write similar code on your own.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 2583
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: Graphic Point Finding & Drawing

Postby piausuk » Thu Apr 21, 2011 6:16 am

Thanks you again, i will try it...
piausuk
 
Posts: 15
Joined: Sun Apr 17, 2011 3:16 pm

Re: Graphic Point Finding & Drawing

Postby piausuk » Thu Apr 21, 2011 7:25 am

Hi Andrew,

I have one question regardless the template matching:

Code: Select all
TemplateMatch[] ProcessImage( Bitmap image, Bitmap template, Rectangle searchZone );


Its say the template's image must smaller then the search zone.
what is it mean.

am i wrong, i thought is we specified a search zone by specified a rectangle points and size
then its will compare both image based on the rectangle field.

Thanks
piausuk
 
Posts: 15
Joined: Sun Apr 17, 2011 3:16 pm

Re: Graphic Point Finding & Drawing

Postby andrew.kirillov » Thu Apr 21, 2011 8:15 am

piausuk wrote:Its say the template's image must smaller then the search zone.

Who says? There is nothing about it in documentation. Or you mean exception? Yes, search zone cannot be smaller than template size, because we search for entire template, not its part. Search zone is just an area of source image to search template in (check docs).

BTW. What is the relation of this question to "Graphic Point Finding & Drawing"? Don't need to create single topic and continue posting to it again and again until all your issues are resolved. If you have a new topic to discuss, then start a new topic. But if you wish to continue conversation within the started topic, then fine.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 2583
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: Graphic Point Finding & Drawing

Postby piausuk » Thu Apr 21, 2011 8:53 am

Dear Andrew,

Ok, thanks, i know what should i do now...

PS
piausuk
 
Posts: 15
Joined: Sun Apr 17, 2011 3:16 pm




Return to Image Processing and Computer Vision