gpt4 book ai didi

c++ - 无法编译此图像旋转代码

转载 作者:行者123 更新时间:2023-11-28 05:10:31 25 4
gpt4 key购买 nike

// 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);

现在的错误是函数 cvWarpAffine 的参数太少,我真的不知道为什么,因为我已经看了这么多例子并从中学习了。请问有人可以帮助我吗?

最佳答案

如果this是正确的引用,那么看起来您正在混合使用 C 和 C++ 接口(interface)。

该文档提供了以下类似 C 的接口(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) )

在这种情况下,您不需要尺寸,但我不明白为什么尺寸没有转换为标志。

关于c++ - 无法编译此图像旋转代码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43606020/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com