Firstly I can not find the C documentation of this function, only for C++: http://docs.opencv.org/modules/video/doc/motion_analysis_and_object_tracking.html#Mat%20estimateRigidTransform%28InputArray%20src,%20InputArray%20dst,%20bool%20fullAffine%29
This is the C prototype I could find:
CVAPI(int) cvEstimateRigidTransform( const CvArr* A, const CvArr* B,
CvMat* M, int full_affine );
It describes that the 2D point set should be given as vector or Mat. Since there are no vectors in C I have to use CvMat instead. If there is another way to represent a point set which is conform with the CvArr* metatype please tell me.
What I currently try is storing each Point of interest in CvMat's as a value > 0.
CvMat* new_frame = cvCreateMat(height, width, CV_8UC1);
CvMat* old_frame = cvCreateMat(height, width, CV_8UC1);
I do not know if this is correct! The relevant points or rather edges of an object are extracted using the Sobel Operator on a gray scaled image. The actual transformation from the old to the new Frame is then computed:
trans = cvCreateMat(2, 3, CV_64FC1);
cvEstimateRigidTransform(new_frame, old_frame, trans, 0);
Now, it could be, this function takes new_frame and old_frame as point sets, which would be correct or as plain Images, where it would use some further magic on it, i do not wish for. How do I avoid the additional magic?
Concluding what is relevant:
- Is there another way to define point set for use with CvArr*
- If not, how do I define a 2D point set in the CvMat's so it explicitly recognises them as such.
- Are the types for the Input Mats CV_MAT_8UC1 and output mat CV_MAT_64FC1 correct?
Also a side note: When i have the type of the transformation matrix a CV_MAT_64FC1 the result is definitly wrong. If I use CV_MAT_32FC1 instead the result seems to be somewhat correct. However, everywhere i looked the type of the matrix was CV_MAT_64FC1, so this confuses me.
Whoever replies: Thanks :)