前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >centos opencv + python

centos opencv + python

作者头像
py3study
发布2020-01-09 20:34:21
1.1K0
发布2020-01-09 20:34:21
举报
文章被收录于专栏:python3python3

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.

代码语言:javascript
复制
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)

代码语言:javascript
复制
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.

代码语言:javascript
复制
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

代码语言:javascript
复制
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()
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2019-09-12 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 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
    领券
    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档