基于opencv的Python图像处理

来源:互联网 发布:网络运营培训课程 编辑:程序博客网 时间:2024/05/28 15:21

图像的打开:

import cv2filename = "/home/vickyleexy/PycharmProjects/33.jpg"img = cv2.imread(filename)print type(img),img.shape,img.dtypecv2.namedWindow("xiamu")cv2.imshow("xiamu",img)cv2.waitKey(0)cv2.destroyAllWindows() #销毁窗口

使用opencv打开图像时报错:
error: /io/opencv/modules/highgui/src/window.cpp:565: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script in function cvNamedWindow

但检查发现gtk什么的已经安装了……
解决方法:
sudo apt-get install python-opencv
同时卸载之前安装的opencv-python
sudo pip uninstall opencv-python

opencv安装:
http://www.samontab.com/web/2014/06/installing-opencv-2-4-9-in-ubuntu-14-04-lts/

0 0
原创粉丝点击