坚持在opencv中在不同方向实现过滤器 [英] stuck in implementing filters in different direction in opencv
问题描述
更新了我的问题
这与我上一个问题有关( OpenCV - 坚持解决练习)。因为,建议我使用我的代码建议的方法,我得到以下错误。
line1.cpp: int main(int,char **)':
line1.cpp:34:10:error:'Point2f'未在此范围内声明
line1.cpp:34:18: ;'before'rgbMat_center'
line1.cpp:35:10:error:'Mat'未在此范围内声明
line1.cpp:35:14:error:expected';'before'mRotation60 '
line1.cpp:36:14:error:expected';'before'mFilter60'
line1.cpp:37:28:错误:'mFilter60'未在此范围内声明
line1.cpp:37:39:error:'mRotation60'未在此范围中声明
line1.cpp:37:59:error:请求'rgbMat'中的成员'size',它是非类类型'CvMat *'
line1.cpp:37:65:错误:warpAffine未在此范围中声明
我的代码在这里。在我的代码中,我试图创建一个5 * 5的2D矩阵,然后尝试使用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());任何人都可以建议我出错的地方吗? h2_lin>解决方案因为Point2f位于
#include opencv2 \core\core.hpp
和 Point2f rgbMat_center(rgbMat.cols / 2.0F,rgbMat.rows / 2.0F);
这是错误的。
rgbMat是指针,因此必须像 rgbMat-> cols
。
Updated my question
Hi it is related to my previous question (OpenCV - stuck in solving an excercise). As, suggested I used the method suggested in my code and I am getting the following errors.
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
my code is here. In my code I tried to create a 5*5 2D matrix first and then tried to rotate the 5*5 matrix in an angle of 60 degree using wrap() of openCV. I am getting the errors showed above. I just want to rotate the 5*5 matrix in 60 degree.
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());
Can anybody suggest where I am going wrong?
解决方案 Because Point2f is in the
#include opencv2\core\core.hpp
And Point2f rgbMat_center(rgbMat.cols/2.0F, rgbMat.rows/2.0F);
this is wrong.
rgbMat is pointer so it has to be like rgbMat->cols
.
这篇关于坚持在opencv中在不同方向实现过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!