Sorry for lengthier explanation. As am new to Open want to give more details with example.
My requirement is to find the delta of 2 static images, for this am using the following technique:
cv::Mat prevImg = cv::imread("prev.bmp");
cv::Mat currImg = cv::imread("curr.bmp");
cv::Mat deltaImg;
cv::absdiff(prevImg,currImg,deltaImg);
cv::namedWindow("image", CV_WINDOW_NORMAL);
cv::absdiff(prevImg,currImg,deltaImg);
cv::imshow("image", deltaImg);
And in the deltaImg, am getting the difference between the images, but it includes the background of the first image also. I know i have to remove the background using BackgroundSubtractorMOG2, but am unable to understand this class usage as most of the examples are based on webcamera captures.
Please note that my images are static (Screen shots of the desktop activity).
Please guide me in resolving this issue, some sample code will be helpful.
Note I want to calculate delta in RGB.
Detailed Explination:
Images are at : https://picasaweb.google.com/105653560142316168741/OpenCV?authkey=Gv1sRgCLesjvLEjNXzZg#
Prev.bmp: The previous screen shot of my dektop
curr.bmp: The current screen shot of my desktop
The delta between the prev.bmp and curr.bmp, should be the startup menu image only, please find the image below:
The delta image should contain only the startup menu, but even contains the background image of the prev.bmp, this background i want to remove.
Thanks in advance.





cv::Mat mask = deltaImg > 0; currImg.copyTo(deltaImg, mask);should work.