opencv 问题

不猜拉倒 2016-04-12 08:12:27
Mat threshold_output;
199 vector<vector<Point> > contours;
200 vector<Vec4i> hierarchy;
201 Point s1, s2;
202 int width_1, height_1;
203 int width = mat1.rows;
204 int height = mat1.cols;
205 int sum = 0;
206
207 int morph_elem = 3;
208 int morph_size = 3;
209
210 int** a = (int**)malloc(width * sizeof(int*));
211
212
213 Mat element = getStructuringElement(MORPH_RECT, Size( 2*morph_size + 1, 2*morph_size+1 ), Point( -1, -1));
214 dilate(mat1, mat1, element);
215
216 /// 找到轮廓
217 findContours(mat1, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0) );
218
219 /// 多边形逼近轮廓 + 获取矩形和圆形边界框
220 vector<vector<Point> > contours_poly( contours.size() );
221 vector<Rect> boundRect( contours.size() );
222 vector<Point2f>center( contours.size() );
223 vector<float>radius( contours.size() );
224
225 for( int i = 0; i < contours.size(); i++ )
226 { approxPolyDP( Mat(contours[i]), contours_poly[i], 3, true );//对多边形曲线做近似
227 boundRect[i] = boundingRect( Mat(contours_poly[i]) );//计算并返回包围轮廓点集的最小矩形
228 minEnclosingCircle( contours_poly[i], center[i], radius[i] );//计算并返回包围轮廓点集的最小圆形及半径
229 }
230
错误提示:
lib/normal.cpp:213:38: error: ‘MORPH_RECT’ was not declared in this scope
lib/normal.cpp:213:106: error: ‘getStructuringElement’ was not declared in this scope
lib/normal.cpp:214:28: error: ‘dilate’ was not declared in this scope怎么解决,求助大虾
...全文
149 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
不猜拉倒 2016-04-13
  • 打赏
  • 举报
回复
找到原因了,哇咔咔

4,447

社区成员

发帖
与我相关
我的任务
社区描述
图形图像/机器视觉
社区管理员
  • 机器视觉
  • 迪菲赫尔曼
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧