Linux系统信息查看命令:
uname -a
Linux node17-charlie 3.10.0-1160.66.1.el7.x86_64 #1 SMP Wed May 18 16:02:34 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
sudo yum install -y cmake gcc gtk2-devel numpy unzip
sudo yum install -y qt5-qtbase-devel python-devel jasper-devel
sudo yum install -y openexr-devel libwebp-devel libjpeg-turbo-devel
sudo yum install -y freeglut-devel mesa-libGL mesa-libGL-devel libtiff-devel
sudo yum install -y libdc1394-devel tbb-devel eigen3-devel
sudo yum install -y boost boost-thread boost-devel libv4l-devel
sudo yum install -y gstreamer-plugins-base-devel
sudo yum install -y gcc-c++
sudo yum install -y ant
版本:OpenCV-4.0.0
百度云盘链接
提取码:5fiu
cd /root/charlie
tar -xzvf opencv-4.0.0.tar.gz
cd opencv-4.0.0
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
遇到错误:CMake 3.5.1 or higher is required. You are running version 2.8.12.2
解决办法:
cmake --version
yum remove cmake
curl -O https://cmake.org/files/v3.6/cmake-3.6.0-Linux-x86_64.tar.gz
tar -zxvf cmake-3.6.0-Linux-x86_64.tar.gz
mv cmake-3.6.0-Linux-x86_64 /usr/local
mv cmake-3.6.0-Linux-x86_64.tar.gz /usr/local
vim /etc/profile
在文件末尾处增加以下代码
export PATH=$PATH:/usr/local/cmake-3.6.0-Linux-x86_64/bin
source /etc/profile
cmake --version
继续执行:
cmake -D CMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local ..
sudo make
sudo make install
#做完这一步正常来说会生成相关jar包,进入opencv存放目录/buld/bin下,可以找到opencv-400.jar,
#通过该jar包可在项目中调用opencv,如果没有找到再执行以下操作,完成后再去上述目录中找jar包
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -DBUILD_TESTS=OFF ..
make -j8
sudo make install
将opencv存放目录/build/lib下的所有后缀为so的文件复制到/usr/local/lib
百度云盘链接
提取码:yam7