Commits

Anonymous committed 1c415fb

alignment changed

Comments (0)

Files changed (1)

project2/photomerge/source-1/alignment.cpp

 #include "alignment.h"
+#include "transition.h"
 
 #include <vector>
 #include <list>
     std::vector<float> th(numImages, 0.0f);
 
     pre_alignment(numImages, sourceImages, tx, ty, th, matches);
-
+	for(int i=0; i<numImages-1; i++){
+		for(int j=0; j<matches.size(); j++){
+			if((matches[j].first == i) && (matches[j].second == matches[j].first + 1))
+				transition(&tx[i+1], &ty[i+1], &th[i+1], matches[j]);
+		}
+	}
+	float _t, _x, _y;
+	for(int i=0; i<numImages-1; i++){
+		_t = th[i] + th[i+1];
+		_x = tx[i] + tx[i+1]*cos(th[i]) - ty[i+1]*sin(th[i]);
+		_y = ty[i] + tx[i+1]*sin(th[i]) + ty[i+1]*cos(th[i]);
+		th[i+1] = _t;
+		tx[i+1] = _x;
+		ty[i+1] = _y;
+	}
+	system("pause");
     return alignment(numImages, sourceImages, tx, ty, th);
   }