Opencv2和Opencv3区别的问题

问题描述

ms@ubuntu:~/Documents/codingtest/ellipse_detection/build$ make
Scanning dependencies of target Circle
[ 50%] Building CXX object CMakeFiles/Circle.dir/main.cpp.o
/home/ms/Documents/codingtest/ellipse_detection/main.cpp: In function ‘int main(int, char**)’:
/home/ms/Documents/codingtest/ellipse_detection/main.cpp:93:71: error: ‘CV_THRESH_BINARY’ was not declared in this scope
  int threshold_value = threshold( src_gray, threshold_output, 0, 255, CV_THRESH_BINARY|CV_THRESH_OTSU);
                                                                       ^
/home/ms/Documents/codingtest/ellipse_detection/main.cpp:93:88: error: ‘CV_THRESH_OTSU’ was not declared in this scope
  int threshold_value = threshold( src_gray, threshold_output, 0, 255, CV_THRESH_BINARY|CV_THRESH_OTSU);
                                                                                        ^
/home/ms/Documents/codingtest/ellipse_detection/main.cpp:94:44: error: ‘CV_RETR_LIST’ was not declared in this scope
  findContours( threshold_output, contours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);
                                            ^
/home/ms/Documents/codingtest/ellipse_detection/main.cpp:94:58: error: ‘CV_CHAIN_APPROX_SIMPLE’ was not declared in this scope
  findContours( threshold_output, contours, CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE);
                                                          ^
CMakeFiles/Circle.dir/build.make:81: recipe for target 'CMakeFiles/Circle.dir/main.cpp.o' failed
make[2]: *** [CMakeFiles/Circle.dir/main.cpp.o] Error 1
CMakeFiles/Makefile2:94: recipe for target 'CMakeFiles/Circle.dir/all' failed
make[1]: *** [CMakeFiles/Circle.dir/all] Error 2
Makefile:102: recipe for target 'all' failed
make: *** [all] Error 2

问题解决

这是opencv2和opencv3区别的问题,理论上出现“CV_XXX”宏的问题,可以先试试:
(1)在“CV_XXX”前面加“cv::CV_XXX”;
(2)去掉“CV_XXX”中的“CV_”,变成“XXX”
测试后编译通过!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值