在学习视觉SLAM十四讲过程中,好多地方的opencv需要更改,查阅了一些资料,在这里做一下总结

1. CV_LOAD_IMAGE_UNCHANGED和CV_LOAD_IMAGE_COLOR

错误内容:

‘CV_LOAD_IMAGE_UNCHANGED‘ : undeclared identifier
error: ‘CV_LOAD_IMAGE_COLOR’ was not declared in this scope

解决办法:

//添加头文件
#include "opencv2/imgcodecs/legacy/constants_c.h" 

2. CV_AA

错误内容:

error: ‘CV_AA’ was not declared in this scope

解决办法:

//添加头文件
#include <opencv2/imgproc/imgproc_c.h>

3. CV_CALIB_CB_ADAPTIVE_THRESH

错误内容:

error: ‘CV_CALIB_CB_ADAPTIVE_THRESH’ was not declared in this scope

解决办法:

//添加头文件
 #include <opencv2/calib3d/calib3d_c.h>

4. CV_GRAY2BGR

错误内容:

error: ‘CV_GRAY2BGR’ was not declared in this scope

解决办法:

  1. 更改代码
//代码改为
cv::COLOR_GRAY2BGR
  1. 添加头文件
//添加头文件
#include <opencv2/imgproc/types_c.h>

5. CV_THRESH_BINARY_INV / CV_CHAIN_APPROX_SIMPLE / CV_RETR_CCOMP / CV_FONT_HERSHEY_SIMPLEX

错误内容:

error: ‘CV_THRESH_BINARY_INV’ was not declared in this scope
error: ‘CV_CHAIN_APPROX_SIMPLE’ was not declared in this scope
error: ‘CV_RETR_CCOMP’ was not declared in this scope
error: ‘CV_FONT_HERSHEY_SIMPLEX’ was not declared in this scope

解决办法:

//代码改为
cv::THRESH_BINARY_INV
cv::CHAIN_APPROX_SIMPLE
cv::RETR_CCOMP
cv::FONT_HERSHEY_SIMPLEX

6. CV_LOAD_IMAGE_GRAYSCALE

错误内容:

error: ‘CV_LOAD_IMAGE_GRAYSCALE’ was not declared in this scope

解决办法:

//代码改为
cv::IMREAD_COLOR

7. CV_FM_8POINT

错误内容:

error: ‘CV_FM_8POINT’ was not declared in this scope

解决办法:

  1. 更改代码
//更改前
CV_FM_8POINTT
//更改后
FM_8POINT
  1. 添加头文件
#include <opencv2/opencv.hpp>

8. CV_FILLED

错误内容:

error: ‘CV_FILLED’ was not declared in this scope

解决办法:

// 添加头文件
#include <opencv2/imgproc/imgproc_c.h>

9. CV_MINMAX

错误内容:

error: ‘CV_MINMAX’ was not declared in this scope

解决办法:

// 添加头文件
#include<opencv2/opencv.hpp>

10. CV_RGB2GRAY

错误内容:

error: ‘CV_RGB2GRAY’ was not declared in this scope

解决办法:

// 添加头文件
#include <opencv2/highgui/highgui_c.h>

11. CV_ADAPTIVE_THRESH_MEAN_C

错误内容:

error: ‘CV_ADAPTIVE_THRESH_MEAN_C’ was not declared in this scope

解决办法:

// 添加头文件
#include <opencv2/calib3d/calib3d_c.h>
GitHub 加速计划 / opencv31 / opencv
142
15
下载
OpenCV: 开源计算机视觉库
最近提交(Master分支:3 个月前 )
d9a139f9 Animated WebP Support #25608 related issues #24855 #22569 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake 2 天前
09030615 V4l default image size #25500 Added ability to set default image width and height for V4L capture. This is required for cameras that does not support 640x480 resolution because otherwise V4L capture cannot be opened and failed with "Pixel format of incoming image is unsupported by OpenCV" and then with "can't open camera by index" message. Because of the videoio architecture it is not possible to insert actions between CvCaptureCAM_V4L::CvCaptureCAM_V4L and CvCaptureCAM_V4L::open so the only way I found is to use environment variables to preselect the resolution. Related bug report is [#25499](https://github.com/opencv/opencv/issues/25499) Maybe (but not confirmed) this is also related to [#24551](https://github.com/opencv/opencv/issues/24551) This fix was made and verified in my local environment: capture board AVMATRIX VC42, Ubuntu 20, NVidia Jetson Orin. ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [X] I agree to contribute to the project under Apache 2 License. - [X] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [X] The PR is proposed to the proper branch - [X] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake 2 天前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐