I Have an image as background, and an image from the background with the shape in it. I want to recognize the shape as fast as possible. One of the things I tried was:
Mat img, img_background;
.
.
.
img = img - img_background;
But in some images, it didn't work. There was another way to compare all of the pixels in both images and it worked, But it was pretty slow. I want to know is there a way to recognize the shape as fast as possible? Thanks for your help.
And I have a question. Why the code I wrote(img = img - img_background) didn't work?
I could fix it with the code below:
cv::absdiff(img, img_bk, img);
Mat m = Mat::zeros(img.size(), img.type());
m.setTo(Scalar::all(255));
img = m - img;
I guess this code works. Thank you for your helps.