hybrid imaging

[output]I've put together this program to make a hybrid image from two given images. It scales them corectly and puts them together but they dont quite line up properly
I've been scouring it for a few hours trying to findsome kind of miscalculation and making minor tweeks. I cant find any thing I need fresh eyes on this

1
2
3
4
5
6
7
8
9
10
11
double theta1 = atan2((double)(p12.y - p11.y),(double)(p12.x - p11.x));
      double theta2 = atan2((double)(p22.y - p21.y),(double)(p22.x - p21.x));

	double thetad = theta2 - theta1;
	Point center = Point(aligned_img2.cols/2, aligned_img2.rows/2);


	Mat Rot_mat = getRotationMatrix2D(center, thetad * 180/3.1415926535898, 1.0);

	warpAffine(aligned_img2, img2, Rot_mat, aligned_img2.size());
	img2.copyTo(aligned_img2);


this is the code segment that rotates the second image to aline the two can anyone see what is wrong here tell me if you need to see more code.
Topic archived. No new replies allowed.