AForge.NET

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

How apply diff image on the original image using AForge Lib

Forum to discuss AForge.NET Framework, its features, API, how-tos, etc.

How apply diff image on the original image using AForge Lib

Postby tridip » Wed Dec 12, 2012 11:32 am

some one guide me how to get difference between two image with same height & width. here is the code using AForge Lib.
Code: Select all
Bitmap overlayImage;
Bitmap sourceImage;

//ToDo: Load the two images.       

// Create filter.
Difference filter = new Difference(overlayImage);
// Apply the filter and return a new bitmap that is the difference between the source and overlay images.
Bitmap resultImage = filter.Apply(sourceImage);

// If you don't want a new image the you can apply the filter directly to the source image.
filter.ApplyInPlace(sourceImage);


now my question is bit different that after getting the difference how can i merge the difference image on my first image at the exact location.
suppose you have two images of your desktop with small difference called img1 and img2. with the help of AForge we can get the difference image with above code. so tell me how can i apply the diff image img3 on my first image img1 with the exact location as a result 3rd image will look like img2 image. is it possible with AForge library.if yes can any one show me the sample code. thanks
tridip
 
Posts: 3
Joined: Wed Dec 12, 2012 11:19 am

Re: How apply diff image on the original image using AForge

Postby andrew.kirillov » Wed Dec 12, 2012 11:52 am

It is not possible with this framework. You will need to write some code to get it. The Difference filter in the framework gives you absolute difference (it does not have sign of the difference), so you can reconstruct image A, if you have image B and difference between B and A.
With best regards,
Andrew


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

Re: How apply diff image on the original image using AForge

Postby tridip » Wed Dec 12, 2012 6:40 pm

thanks....yes basically i have to reconstruct img1, if i have img2 and difference between img2 and img1. can u please guide me with sample code.
tridip
 
Posts: 3
Joined: Wed Dec 12, 2012 11:19 am

Re: How apply diff image on the original image using AForge

Postby andrew.kirillov » Wed Dec 12, 2012 7:47 pm

You can take source code of Difference filter and other routines as a sample of how to do some image processing.
With best regards,
Andrew


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

Re: How apply diff image on the original image using AForge

Postby tridip » Thu Dec 13, 2012 5:22 pm

one person told me it may be possible by using AForge.Imaging.Filters.Add method. we can merge the diff image on first image. can u give me some code snippet for AForge.Imaging.Filters.Add which show me how to use this in my contex and achieve my goal. thanks
tridip
 
Posts: 3
Joined: Wed Dec 12, 2012 11:19 am

Re: How apply diff image on the original image using AForge

Postby andrew.kirillov » Thu Dec 13, 2012 7:27 pm

tridip wrote:one person told me it may be possible by using AForge.Imaging.Filters.Add method.

He did lie to you. I already told you before that Difference filter produce absolute difference, there is no sign in it – it is all positive. It does not show which way it is different.
With best regards,
Andrew


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




Return to AForge.NET Framework