I am trying to make a program, which finds homogeneous coordinates from two same pictures, but where the objects have been rotated or translated and then taking the first picture and overlay it on the second picture.
The problem is, that i am getting a Matrix error, because i have different matrix sizes.
I have found the solution, which i need to apply to rotate and translate to get the first picture on the second (the values, which i have to apply on the second matrix)
This is my code:
Size size(image2.cols, image2.rows);
Mat dest = cv::Mat::zeros(image2.rows, image2.cols, CV_32FC2);
warpAffine(image2, dest, t, size);
namedWindow("manipulated img", CV_WINDOW_NORMAL);
imshow("manipulated img", dest);
Mat output;
cout << image1.size() << endl;
cout << dest.size() << endl;
bitwise_and(dest, image1, output);
//subtract(dest, image1, output);
namedWindow("output img", CV_WINDOW_NORMAL);
imshow("output img", output);
I get the following error:
> [3722 x 2937]
> [3722 x 2932]
> OpenCV Error: Sizes of input arguments do
> not match (The operation is neither 'a rray op array' (where arrays
> have the same size and type), nor 'array op scalar' , nor 'scalar op
> array') in cv::binary_op, file C:\builds\master_PackSlave-win32
> -vc12-shared\opencv\modules\core\src\arithm.cpp, line 1573
I think i know what the problem is, but i dont know what the solution is.
The Matrices have different size
image1.size() = [3722 x 2937]
dest.size() = [3722 x 2932]
What can i do, to solve this?