Debian || Ubuntu编译安装OpenCV(Only C++ without Python!)

Debian源码编译安装OpenCV C++版本

Only compile opencv c++, without python and java.

  • first step: install dependency.

sudo apt-get install build-essential
sudo apt-get install cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev qtbase5-dev libtiff-dev

  • second step: download opencv source code.

In Linux operate system, you can use this command line: wget https://github.com/opencv/opencv/archive/4.1.0.zip, or use git clone https://github.com/opencv/opencv.git

  • third step

Entire the opencv source code directory and make a directory build, and you can also use another name, it’s no matter.

  • forth step: without build python and java model

In CMakeLists.txt file, delete the python model and java model.
Delete python model
Delete Java Model
Entire the directory that you made just a minute ago, and in this directory, execute the following command:
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=~/${your_directory}
I suggest the CMAKE_INSTALL_PREFIX opencv in a directory that you want to install and don’t use : /usr/local directory, because if you want to uninstall this version of opencv, you can only delete the directory that you installed opencv.
In this blog, I use the following command to install OpenCV in my laptop:

  • cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/home/wangheng/app/opencv4
    Maybe you want to install with CUDA or CUDNN, you can add the string: -D WITH_CUDA=ON and so on.
    在这里插入图片描述
  • finally make -j2 ; make install
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值