imshow python卡住,在opencv-python中的imshow不起作用

Error occurred and the program crashed when I executed cv2.imshow.

My code was just

import cv2

sscv = cv2.imread('/home/myuser/Pictures/Workspace 1_007.png',0)

cv2.imshow("screenshot image", sscv)

cv2.waitKey(0)

The showed Error is

/home/mallory/workspace/python-autoaction/test/test_xutils.py:11: Warning: cannot register existing type 'GdkDisplayManager'

cv2.imshow("screenshot image", sscv)

/home/mallory/workspace/python-autoaction/test/test_xutils.py:11: Warning: g_once_init_leave: assertion 'result != 0' failed

cv2.imshow("screenshot image", sscv)

/home/mallory/workspace/python-autoaction/test/test_xutils.py:11: Warning: g_object_new: assertion 'G_TYPE_IS_OBJECT (object_type)' failed

cv2.imshow("screenshot image", sscv)

/home/mallory/workspace/python-autoaction/test/test_xutils.py:11: Warning: invalid (NULL) pointer instance

cv2.imshow("screenshot image", sscv)

/home/mallory/workspace/python-autoaction/test/test_xutils.py:11: Warning: g_signal_connect_data: assertion 'G_TYPE_CHECK_INSTANCE (instance)' failed

cv2.imshow("screenshot image", sscv)

/home/mallory/workspace/python-autoaction/test/test_xutils.py:11: Warning: cannot register existing type 'GdkDisplay'

cv2.imshow("screenshot image", sscv)

/home/mallory/workspace/python-autoaction/test/test_xutils.py:11: Warning: g_type_register_static: assertion 'parent_type > 0' failed

cv2.imshow("screenshot image", sscv)

Segmentation fault (core dumped)

using

Ubuntu 14.0.4

Python 2.7.6

cv2 2.4.8

What was wrong with that?

解决方案

Try installing these dependency again and let me know if problem persists

sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libfaac-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils ffmpeg cmake qt5-default checkinstall

After that just do

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D WITH_TBB=ON -D BUILD_NEW_PYTHON_SUPPORT=ON -D WITH_V4L=ON -D INSTALL_C_EXAMPLES=ON -D INSTALL_PYTHON_EXAMPLES=ON -D BUILD_EXAMPLES=ON -D WITH_QT=ON -D WITH_OPENGL=ON ..

make -j2

sudo checkinstall

sudo sh -c 'echo "/usr/local/lib" > /etc/ld.so.conf.d/opencv.conf'

sudo ldconfig

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值