-3

更新了我的问题

嗨,这与我之前的问题有关(OpenCV - 坚持解决练习)。正如,建议我使用我的代码中建议的方法,我收到以下错误。

line1.cpp: In function ‘int main(int, char**)’:
line1.cpp:34:10: error: ‘Point2f’ was not declared in this scope
line1.cpp:34:18: error: expected ‘;’ before ‘rgbMat_center’
line1.cpp:35:10: error: ‘Mat’ was not declared in this scope
line1.cpp:35:14: error: expected ‘;’ before ‘mRotation60’
line1.cpp:36:14: error: expected ‘;’ before ‘mFilter60’
line1.cpp:37:28: error: ‘mFilter60’ was not declared in this scope
line1.cpp:37:39: error: ‘mRotation60’ was not declared in this scope
line1.cpp:37:59: error: request for member ‘size’ in ‘rgbMat’, which is of non-class  type ‘CvMat*’
line1.cpp:37:65: error: ‘warpAffine’ was not declared in this scope

我的代码在这里。在我的代码中,我首先尝试创建一个 5*5 2D 矩阵,然后尝试使用 openCV 的 wrap() 将 5*5 矩阵旋转 60 度。我收到上面显示的错误。我只想将 5*5 矩阵旋转 60 度。

     double angleDegree = 60;
     Point2f rgbMat_center(rgbMat.cols/2.0F, rgbMat.rows/2.0F);
     Mat mRotation60= getRotationMatrix2D(rgbMat_center, -angleDegree, 1.0);
     Mat mFilter60;
     warpAffine(rgbMat, mFilter60, mRotation60, rgbMat.size());

有人可以建议我哪里出错了吗?

4

1 回答 1

2

因为 Point2f 在

#include opencv2\core\core.hpp

Point2f rgbMat_center(rgbMat.cols/2.0F, rgbMat.rows/2.0F);是错误的。

rgbMat 是指针,所以它必须像rgbMat->cols.

于 2013-07-10T11:01:08.170 回答