innocent boy
innocent boy

Reputation: 315

Can not compile this Image Rotation code

// rotate the image
frame = cvQueryFrame(capture);
int dx,dy,s; 
double thetaDegree;
double thetaRadian;

//for rotation
IplImage *Rotation;
Rotation = cvCloneImage(frame);
Rotation->origin = frame->origin;
CvZero(Rotation);

//get the rotation degree

thetaRadian = atan(s);      // **the s I have algorithm to do the calculation **
thetaDegree = thetaRadian *(180 / PI);

CvMat *rot = cvgetRotationMatrix2D(center, thetaDegree, 1.0);
cvWarpAffine(frame, Rotation, rot,sizeof(frame));

cvNameWindow("Rotation",1);
cvShowImage("Rotation",Rotation);
cvReleaseImage(&Rotation);
cvReleaseMat(&rot);

Now the error is that too few arguments to the function cvWarpAffine and I really do not know why because I have gone through so many examples and learn from them. Please, can someone help me?

Upvotes: 0

Views: 67

Answers (1)

Paul Floyd
Paul Floyd

Reputation: 6906

If this is the right reference, then it looks like you are mixing the C and C++ interfaces.

The doc gives the following C-like interface:

C: void cvWarpAffine(const CvArr* src, CvArr* dst, const CvMat* map_matrix,
                     int flags=CV_INTER_LINEAR+CV_WARP_FILL_OUTLIERS,
                     CvScalar fillval=cvScalarAll(0) )

In which case you don't need the size, but I don't see why the size doesn't get converted to the flags.

Upvotes: 1

Related Questions