参考链接:
1,cmake编译
http://blog.csdn.net/baidu_36316735/article/details/53168438
2,CLion导入opencv
http://blog.csdn.net/xiangxianghehe/article/details/71438789
另外在VS中配置opencv3可以参考我的这篇博文:
OpenCV3.2.0+VS2017环境配置与常见问题(巨细坑爹版)
另外:mac + pycharm 可以参考我这篇blog:
Mac + OpenCV3.3.0 + PyCharm (非常简单的配置过程)
下载CLion、CMake、OpenCV3.3.0我就不说了,JetBeans用学生邮箱可以申请全家桶免费。
下面主要讲讲配置
开始
1,在Download/opencv-3.3.0/创建build文件夹用来存编译后文件
2,打开CMake,填好OpenCV路径和build的路径->configure->Done->等->Generate
3,打开终端,用cd命令进入build文件夹目录,然后输入命令
make
然后,等它编译到100%,然后输入命令
sudo make install
4,创建一个项目,我的叫opencv3_demo
//打开摄像头样例
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/core/core.hpp>
using namespace cv;
int main()
{
VideoCapture cap(0);
Mat frame;
while(1)
{
cap >> frame;
imshow("调用摄像头", frame);
waitKey(0);
}
return 0;
}
改变CMakeLists.txt
cmake_minimum_required(VERSION 3.7)
project(opencv3_demo)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES main.cpp)
add_executable(opencv3_demo ${SOURCE_FILES})
find_package(OpenCV REQUIRED)
target_link_libraries(opencv3_demo ${OpenCV_LIBS})