error: ‘CV_THRESH_BINARY_INV’ was not declared in this scope / error: ‘CV_THRESH_OTSU’ was not dec

18 篇文章 2 订阅

在jetson xavier NX上面编译caffe的时候遇到下面的错误,用的是opencv4.0,下面记录下编译caffe过程中的opencv错误;

src/caffe/util/im_transforms.cpp:248:19: error: ‘CV_THRESH_BINARY_INV’ was not declared in this scope
                   CV_THRESH_BINARY_INV | CV_THRESH_OTSU);
                   ^~~~~~~~~~~~~~~~~~~~
src/caffe/util/im_transforms.cpp:248:19: note: suggested alternative: ‘CU_PREFER_BINARY’
                   CV_THRESH_BINARY_INV | CV_THRESH_OTSU);
                   ^~~~~~~~~~~~~~~~~~~~
                   CU_PREFER_BINARY
src/caffe/util/im_transforms.cpp:248:42: error: ‘CV_THRESH_OTSU’ was not declared in this scope
                   CV_THRESH_BINARY_INV | CV_THRESH_OTSU);
                                          ^~~~~~~~~~~~~~
src/caffe/util/im_transforms.cpp:248:42: note: suggested alternative: ‘CV__TEST_GT’
                   CV_THRESH_BINARY_INV | CV_THRESH_OTSU);
                                          ^~~~~~~~~~~~~~
                                          CV__TEST_GT
src/caffe/util/im_transforms.cpp:251:19: error: ‘CV_THRESH_BINARY_INV’ was not declared in this scope
                   CV_THRESH_BINARY_INV | CV_THRESH_OTSU);
                   ^~~~~~~~~~~~~~~~~~~~
src/caffe/util/im_transforms.cpp:251:19: note: suggested alternative: ‘CU_PREFER_BINARY’
                   CV_THRESH_BINARY_INV | CV_THRESH_OTSU);
                   ^~~~~~~~~~~~~~~~~~~~
                   CU_PREFER_BINARY
src/caffe/util/im_transforms.cpp:251:42: error: ‘CV_THRESH_OTSU’ was not declared in this scope
                   CV_THRESH_BINARY_INV | CV_THRESH_OTSU);
                                          ^~~~~~~~~~~~~~
src/caffe/util/im_transforms.cpp:251:42: note: suggested alternative: ‘CV__TEST_GT’
                   CV_THRESH_BINARY_INV | CV_THRESH_OTSU);
                                          ^~~~~~~~~~~~~~
                                          CV__TEST_GT

上面的错误很明显是因为不同的opencv版本里面宏定义的名字有微小的差别,从上面的错误提示中可以看到,编译器建议我用‘CU_PREFER_BINARY’替换CV_THRESH_BINARY_INV,用‘CV__TEST_GT’替换 CV_THRESH_OTSU。我按照他的建议修改了之后还是不行,于是我做了下面的修改,

CV_THRESH_BINARY_INV 修改为cv::THRESH_BINARY_INV

CV_THRESH_OTSU修改为cv::THRESH_OTSU

问题解决!

然后还有下面的错误。

src/caffe/util/im_transforms.cpp:442:42: error: ‘CV_BGR2YCrCb’ was not declared in this scope
       cv::cvtColor(out_img, ycrcb_image, CV_BGR2YCrCb);
                                          ^~~~~~~~~~~~
src/caffe/util/im_transforms.cpp:452:42: error: ‘CV_YCrCb2BGR’ was not declared in this scope
       cv::cvtColor(ycrcb_image, out_img, CV_YCrCb2BGR);
                                          ^~~~~~~~~~~~
src/caffe/util/im_transforms.cpp:465:42: error: ‘CV_BGR2YCrCb’ was not declared in this scope
       cv::cvtColor(out_img, ycrcb_image, CV_BGR2YCrCb);
                                          ^~~~~~~~~~~~
src/caffe/util/im_transforms.cpp:475:42: error: ‘CV_YCrCb2BGR’ was not declared in this scope
       cv::cvtColor(ycrcb_image, out_img, CV_YCrCb2BGR);

修改方法为:

CV_xxx  修改为  cv::COLOR_xxx,例如CV_BGR2GRAY   修改为    cv::COLOR_BGR2GRAY

但是

CV_IMWRITE_JPEG_QUALITY  修改为  cv::COLOR_IMWRITE_JPEG_QUALITY不行,要修改为cv::IMWRITE_JPEG_QUALITY

CV_LOAD_IMAGE_COLOR  修改为  cv::COLOR_LOAD_IMAGE_COLOR不行,要修改为  cv::IMREAD_COLOR

继续,还有错误

src/caffe/util/bbox_util.cpp: In function ‘void caffe::VisualizeBBox(const std::vector<cv::Mat>&, const caffe::Blob<Dtype>*, float, const std::vector<cv::Scalar_<double> >&, const std::map<int, std::__cxx11::basic_string<char> >&, const string&)’:
src/caffe/util/bbox_util.cpp:2510:42: error: ‘CV_FILLED’ was not declared in this scope
                   CV_RGB(255, 255, 255), CV_FILLED);
                                          ^~~~~~~~~
src/caffe/util/bbox_util.cpp:2510:42: note: suggested alternative: ‘CLD_KILLED’
                   CV_RGB(255, 255, 255), CV_FILLED);
                                          ^~~~~~~~~
                                          CLD_KILLED
src/caffe/util/bbox_util.cpp:2545:48: error: there are no arguments to ‘CV_FOURCC’ that depend on a template parameter, so a declaration of ‘CV_FOURCC’ must be available [-fpermissive]
         cv::VideoWriter outputVideo(save_file, CV_FOURCC('D', 'I', 'V', 'X'),
                                                ^~~~~~~~~
src/caffe/util/bbox_util.cpp:2545:48: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
src/caffe/util/bbox_util.cpp: In instantiation of ‘void caffe::VisualizeBBox(const std::vector<cv::Mat>&, const caffe::Blob<Dtype>*, float, const std::vector<cv::Scalar_<double> >&, const std::map<int, std::__cxx11::basic_string<char> >&, const string&) [with Dtype = float; std::__cxx11::string = std::__cxx11::basic_string<char>]’:
src/caffe/util/bbox_util.cpp:2564:43:   required from here
src/caffe/util/bbox_util.cpp:2545:57: error: ‘CV_FOURCC’ was not declared in this scope
         cv::VideoWriter outputVideo(save_file, CV_FOURCC('D', 'I', 'V', 'X'),
                                                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
src/caffe/util/bbox_util.cpp:2545:57: note: suggested alternative: ‘CV_16UC’
         cv::VideoWriter outputVideo(save_file, CV_FOURCC('D', 'I', 'V', 'X'),
                                                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
                                                CV_16UC
src/caffe/util/bbox_util.cpp: In instantiation of ‘void caffe::VisualizeBBox(const std::vector<cv::Mat>&, const caffe::Blob<Dtype>*, float, const std::vector<cv::Scalar_<double> >&, const std::map<int, std::__cxx11::basic_string<char> >&, const string&) [with Dtype = double; std::__cxx11::string = std::__cxx11::basic_string<char>]’:
src/caffe/util/bbox_util.cpp:2570:43:   required from here
src/caffe/util/bbox_util.cpp:2545:57: error: ‘CV_FOURCC’ was not declared in this scope
src/caffe/util/bbox_util.cpp:2545:57: note: suggested alternative: ‘CV_16UC’
         cv::VideoWriter outputVideo(save_file, CV_FOURCC('D', 'I', 'V', 'X'),
                                                ~~~~~~~~~^~~~~~~~~~~~~~~~~~~~
                                                CV_16UC
Makefile:585: recipe for target '.build_release/src/caffe/util/bbox_util.o' failed
make: *** [.build_release/src/caffe/util/bbox_util.o] Error 1

修改CV_FILLED为cv::FILLED

CV_FOURCC为cv::VideoWriter::fourcc

  • 9
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

陈 洪 伟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值