坚持在opencv中实现不同方向的过滤器

时间:2013-07-10 10:34:32

标签: c++ opencv image-processing

更新了我的问题

嗨,这与我之前的问题(OpenCV - stuck in solving an excercise)有关。因为,建议我使用我的代码中建议的方法,我收到以下错误。

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的二维矩阵,然后尝试使用openCV的wrap()以60度的角度旋转5 * 5矩阵。我收到上面显示的错误。我只想在60度旋转5 * 5矩阵。

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

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

1 个答案:

答案 0 :(得分:2)

因为Point2f在

#include opencv2\core\core.hpp

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

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