3

i want to compare two images like image1.png and image2.png.both the images look pretty same with some difference. so i want to get the difference and want to apply the difference on first image image1.png. i searched lot to get similar kind of code of this library but found none.

after lots of search i got bit similar kind of things which i am looking for in java code. here is the url http://mindmeat.blogspot.in/2008/07/java-image-comparison.html

please go to the url and there you can see the code generate 3rd image with difference but my requirement is bit different. i do not want to generate 3rd image rather i want to apply the difference on the 1st image image1.png. some one told me it can be done very easily with emgu cv library. so i search for similar code based on emgu cv library but found no. it will be great help me anyone can guide me with sample code using emgu cv library.

thanks

Thomas
  • 33,544
  • 126
  • 357
  • 626
  • What do you mean by "apply the difference" ? If it is related to merging the differences with the first image, you might be after in-painting. See http://stackoverflow.com/questions/13602499/how-to-find-the-error-image/13666082#13666082 for an example of in-paintaing if you are not sure if that is what you are after. – mmgp Dec 31 '12 at 03:08

1 Answers1

2

I think what you require is:

image1 = image2 - image1;

Due to operator overloading, this is possible directly in Emgu CV

Umair
  • 111
  • 1
  • 10
  • can you plzz come with a sample code in c# what u said. thanks – Thomas Oct 14 '14 at 17:49
  • 1
    It's simple. Just read two images that you need to subtract. Image img1 = new Image("C:\\image1.png"); Image img2 = new Image("C:\\image2.png"); Image img3 = img2 - img1; //Here the difference is applied. – Umair Oct 15 '14 at 15:17
  • from your guidance i came to know how to subtract two images using EmguCV library.can u guide me how to merge diff image with first image.as example say i have two images 1st image is full green image and second image is full green but have red circle at middle right corner. when i got the diff image after subtract then how can i merge the diff portion with full green image as a result my new merge image will look like full green image with red circle at middle right corner. can u please suggest anything how to achieve it with EmguCV library.give me a sample code using EmguCV library.thanks – Thomas Oct 18 '14 at 07:20
  • Image3 = image2 - image1; Image3 = Image3 + Image1; – Umair Oct 18 '14 at 11:10
  • i was expecting that u would give sample code. anyway i will try thanks. – Thomas Oct 18 '14 at 14:54