저는 최근 opencv에서 작업하고 있습니다. 내 우분투 16.04에 설치했습니다. 나는 그것이 몇 가지 문제가 있다고 생각한다. 나는 함수는이 오류를 야기cv2.imshow() 구현 중 문제가 발생했습니다
cv2.imshow('frame',frame)
를 실행하려고 할 때마다
OpenCV Error: Unspecified error (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 cvShowImage, file /tmp/build/80754af9/opencv_1512687413662/work/modules/highgui/src/window.cpp, line 611
Traceback (most recent call last):
File "hands.py", line 12, in <module>
cv2.imshow('frame',frame)
cv2.error: /tmp/build/80754af9/opencv_1512687413662/work/modules/highgui/src/window.
cpp:611: 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 cvShowImage
내가 실행하려고 코드는 내가 가능한 모든 일을 Google에 노력하고있어 모든 것을했다
import numpy as numpy
import cv2
import matplotlib.pyplot as plt
cap = cv2.VideoCapture(0)
bg = cv2.bgsegm.createBackgroundSubtractorMOG()
while True:
ret,frame = cap.read()
vid = bg.apply(frame)
cv2.imshow('frame',frame)
cv2.imshow('vid',vid)
key = cv2.waitKey(0) & 0xff
if key == 27:
break
cap.release()
cap.destroyAllWindows()
입니다 가능하지만 여전히 문제를 해결할 수는 없습니다.
내가 대신cv2.imshow('frame',frame)
의
matplotlib.pyplot.imshow('frame',frame)
matplotlib.pyplot.show()
를 사용하여 시도하지만이 웹캠에서 캡처 한 비디오를 표시하는 오류를
TypeError: unhashable type: 'numpy.ndarray'
을 제공합니다. 비디오 또는이 오류 대신 cv2.waitkey()에서 이미지 및 오류 만 표시합니다. 이 오류를 해결할 방법이 있습니까? 또는 cv2 GUI 기능을 구현하려면?
가 읽어주십시오과 [mcve] 이해를 참조 할 것이다. 오류를 얻기 위해 실행중인 코드가 명확하지 않습니다. 여기서 어떻게 도와야합니까? – ImportanceOfBeingErnest
불완전한 질문에 대한 미안 해요, 내 코드 조각을 게시했습니다. 그걸로 나를 도울 수 있니? – Darshan