OpenCV功能未实现,用windows Error重建库

问题描述 投票:0回答:0
cap = cv2.VideoCapture(0)
while cap.isOpened(): 
    ret, frame = cap.read()
    
    frame = frame[120:120+250,200:200+250, :]
    
    cv2.imshow('Image Collection', frame)
    if cv2.waitKey(1) & 0XFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()
---------------------------------------------------------------------------
error                                     Traceback (most recent call last)
<ipython-input-2-99572a850d8f> in <module>
      6     frame = frame[120:120+250,200:200+250, :]
      7 
----> 8     cv2.imshow('Image Collection', frame)
      9 
     10     # Breaking gracefully

error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\highgui\src\window.cpp:1272: error: (-2:Unspecified error) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Cocoa 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'

我正在尝试上面的代码并收到以下错误,任何人都可以帮我解决这个问题吗?

opencv image-processing video-capture cv2
© www.soinside.com 2019 - 2024. All rights reserved.