centos opencv + python 配置
Posted 灬鬼谷灬
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了centos opencv + python 配置相关的知识,希望对你有一定的参考价值。
opencv + python 配置
Table of Contents
- 1. Installing OpenCV from source
- 1.1. We need CMake to configure the installation, GCC for compilation, Python-devel and Numpy for creating Python extensions etc.
- 1.2. Next we need GTK support for GUI features, Camera support (libdc1394, libv4l), Media Support (ffmpeg, gstreamer)
- 1.3. OpenCV comes with supporting files for image formats like PNG, JPEG, JPEG2000, TIFF, WebP etc. But it may be a little old. If you want to get latest libraries, you can install development files for these formats.
- 1.4. install OpenCV
- 1.5. test.py
1 Installing OpenCV from source
1.1 We need CMake to configure the installation, GCC for compilation, Python-devel and Numpy for creating Python extensions etc.
yum install cmake yum install python-devel numpy yum install gcc gcc-c++
1.2 Next we need GTK support for GUI features, Camera support (libdc1394, libv4l), Media Support (ffmpeg, gstreamer)
yum install gtk2-devel yum install libdc1394-devel yum install libv4l-devel yum install ffmpeg-devel yum install gstreamer-plugins-base-devel
1.3 OpenCV comes with supporting files for image formats like PNG, JPEG, JPEG2000, TIFF, WebP etc. But it may be a little old. If you want to get latest libraries, you can install development files for these formats.
yum install libpng-devel yum install libjpeg-turbo-devel yum install jasper-devel yum install openexr-devel yum install libtiff-devel yum install libwebp-devel
1.4 install OpenCV
- yum install opencv
- yum install opencv-python
- yum install opencv-devel (opencv 开发包,含有头文件, for c++)
1.5 test.py
import cv2
import numpy as np
img = np.zeros((512, 512, 3), np.uint8)
cv2.line(img, (0,0), (511, 511), (255, 0, 0), 5)
cv2.imshow('img',img)
cv2.waitKey(1000)
cv2.destroyAllWindows()
以上是关于centos opencv + python 配置的主要内容,如果未能解决你的问题,请参考以下文章
CentOS下安装好python和opencv,却import cv2失败
CentOS 安装 opencv, 解决 Python cv2 module 问题(终极解决方法)