Get the mask image of the difference between the two Emgu CV images

I was wondering how to take two different gray images and create a mask of differences between them. Any help would be greatly appreciated.

+5
source share
1 answer

Assuming the camera is stationary and the images are very good, you can find the differences between the two images using elemental subtraction. Using the OpenCV C ++ API, it will look something like this (note: this code has not been verified):

void FindDifference(cv::Mat src1, cv::Mat src2, cv::Mat &dst, int threshold) {
    dst = cv::abs(src2 - src1);
    cv::threshold(dst, dst, threshold, 255, cv::THRESH_BINARY);
}

threshold, , . , .

API- EmuCV, API .

+4

All Articles