1 | initial version |
Of course you can subtract two images using OpenCV. Something like this should work:
cv::Mat1f img1 = cv::imread("image1.png", cv::LOAD_IMAGE_GRAYSCALE);
cv::Mat1f img2 = cv::imread("image2.png", cv::LOAD_IMAGE_GRAYSCALE);
cv::Mat1f sub = img1 - img2; // Now all pixels != 0 are different pixels
From here on you can proceed further, some possible involved steps:
GaussianBlur()
, or use CLOSE as morphological Operator (morphologyEx
) to close some of the holesfindContours()
to find all contours.minEnclosingCircle()
to draw a circle around each found contour