Comparing images

Discussions about Automatic Document Recognition in GdPicture.NET.
Post Reply
mjnaleva
Posts: 14
Joined: Fri Jul 03, 2009 8:44 pm

Comparing images

Post by mjnaleva » Fri Aug 20, 2010 5:37 am

Hi there,

I have been reading about how GdPicture can compare images and also overlay images on top of each. But, I am wondering if there is a way using the API to overlay images and highlight the differences perhaps with a different color. I'm dealing with mostly B/W images and need a way to highlight differences between images. I see API with the Automatic Document Recognition add-in that will say to what degree files are the same, but is there a visual interpretation currently available or being planned for in the future?

Thanks,
Mark

User avatar
Loïc
Site Admin
Posts: 5597
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: Comparing images

Post by Loïc » Fri Aug 20, 2010 2:45 pm

Hi Mark,

No need ADR for that, there is already a lot of function in GdPicture to get difference between 2 pictures. Here a way to do that (compatible with bitonal and colour image).

Code: Select all

      Dim oGdPictureImaging As New GdPictureImaging
      oGdPictureImaging.SetLicenseNumber("XXX")
      Dim Image1 As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("c:\image1.png")
      Dim ImageHeight As Integer = oGdPictureImaging.GetHeight(Image1)
      Dim ImageWidth As Integer = oGdPictureImaging.GetWidth(Image1)
      Dim Image2 As Integer = oGdPictureImaging.CreateGdPictureImageFromFile("c:\image2.png")

      oGdPictureImaging.DrawGdPictureImageOP(Image1, Image2, 0, 0, ImageWidth, ImageHeight, Operators.OperatorXor, Drawing2D.InterpolationMode.NearestNeighbor)
      oGdPictureImaging.ConvertTo1Bpp(Image2)
      oGdPictureImaging.FxNegative(Image2)
      oGdPictureImaging.SaveAsPNG(Image2, "c:\image3.png")

      oGdPictureImaging.ReleaseGdPictureImage(Image1)
      oGdPictureImaging.ReleaseGdPictureImage(Image2)
image1.png
Image1
image1.png (8.02 KiB) Viewed 2605 times
image2.png
image2
image2.png (7.7 KiB) Viewed 2605 times
image3.png
differences
image3.png (334 Bytes) Viewed 2605 times

mjnaleva
Posts: 14
Joined: Fri Jul 03, 2009 8:44 pm

Re: Comparing images

Post by mjnaleva » Fri Aug 20, 2010 6:03 pm

Thanks. I will play around with it some more to see what all the capabilities exist.

On a related note, when overlaying images, is there a way to quickly turn on/off the display of the second image without extensive image processing needing to be done? For example, I am thinking of allowing the user to add markups perhaps to a second image that overlays on the original image but when doing a CopyToClipBoard() operation I would only like the original image contents to be copied. Hope that makes sense.

Mark

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests