centos opencv + python 配置

来源:互联网 发布:暴风影音怎么关闭网络 编辑:程序博客网 时间:2024/06/06 19:04

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 cmakeyum install python-devel numpyyum 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-develyum install libdc1394-develyum install libv4l-develyum install ffmpeg-develyum 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-develyum install libjpeg-turbo-develyum install jasper-develyum install openexr-develyum install libtiff-develyum 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 cv2import numpy as npimg = 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()

0 0
原创粉丝点击