find the differences between two images pixel I want to show on the screen with imshow method How can I do
Mat difference(Mat frame1, Mat frame2)
{
Mat image = frame1.clone();
for (int rows = 0; rows < image.rows; rows++)
{
for (int cols = 0; cols < image.cols; cols++)
{
image.at<cv::Vec3b>(rows, cols)[0] = abs(frame1.at<cv::Vec3b>(rows, cols)[0] -
frame2.at<cv::Vec3b>(rows, cols)[0]);
image.at<cv::Vec3b>(rows, cols)[1] = abs(frame1.at<cv::Vec3b>(rows, cols)[1] -
frame2.at<cv::Vec3b>(rows, cols)[1]);
image.at<cv::Vec3b>(rows, cols)[2] = abs(frame1.at<cv::Vec3b>(rows, cols)[2] -
frame2.at<cv::Vec3b>(rows, cols)[2]);
}
}
return image;
}
int main()
{
Mat src = imread(file name);
Mat curr_frame = imread(file name);
Mat image = src.clone();
cout << image.rows;
cout << image.cols;
differenceFrame(src, curr_frame);
system("pause");
}