1、安装OpenCV库
sudo apt install libopencv-dev
2、链接库
将 OpenCV 头文件路径和库添加到CMake中,在 CMakeLists.txt 中添加
1)查找库
find_package(OpenCV REQUIRED)
或者
find_package(OpenCV REQUIRED core imgproc highgui)
2)添加头文件路径
include_directories(${OpenCV_INCLUDE_DIRS})
3)链接库
target_link_libraries(laoer ${OpenCV_LIBS} )
3、加载、保存图片
当使用cv::imread读取、cv::imwrite保存图片时,图像默认为BGR格式。
1)加载图片
cv::Mat mat_bgr= cv::imread