if in opencv c++ api while creating rotation matrix if write
       mat rot_matrix = getrotationmatrix2d(src_center, angle, 1.0);   then how should write in opencv c? should write instead of mat? this:-
         cvmat* rot_mat =cv2drotationmatrix( center, angle, scale, rot );   is above declaration correct? if yes, how can represent in wrap affine function? this:-
         cvwarpaffine( src, dst, rot_mat);      
i think bit confused according our little chat @ comments sector, decided write answer try make bit clearer.
first original question wrote mat indeed c++ form.
in c use cvmat function cv2drotationmatrix() takes cvmat * part of parameters therefore can used that:
 cv2drotationmatrix(center,angle,scale,rot_mat);   where:
- center 
cvpoint2d32f, center of rotation in source image (width/2,height/2). - angle – desired rotation angle(in degrees).
 - scale – isotropic scale factor (1 means picture kept @ same size)
 - mapmatrix – pointer destination matrix (your 2x3 matrix used rotation matrix)
 
now rot_mat hold rotation matrix:

where:

now calculate position of each pixel after rotating whole picture in x degrees (an affine transformation on pixels/pciture/image).
at stage have rotation matrix being used in affine transformation , want affine transformation (rotating image) can use function cvwarpaffine() 
in our case:
cvwarpaffine( src, dst, rot_mat );   where:
- src – source image
 - dst – destination image
 - rot_mat our mapmatrix(transformation matrix)
 
*there fourth parameter flag default o.k our case.
what does?
transforms source image using specified matrix:


*or in simpler words described before "just" calculates new position each pixel after rotation (using rotation matrix - input affine function).
rot_mat should 2x3 mat - can create calling cvcreatemat().
src,dst iplimage * (because said it's c code).
*the technical aspect of function from: http://opencv.willowgarage.com/documentation/geometric_image_transformations.html
Comments
Post a Comment