Как исправить ошибку OpenCV==4.6.0.77 Python3

Запускаю программу:

import cv2
import numpy as np
from time import time

cap = cv2.VideoCapture(0)

timer = time()
x = 0
fps = 0

while True:
    if(time() - timer >= 1):
        fps = x
        x = 0
        timer = time()
    ret, frame = cap.read()
    frame = cv2.flip(frame, -1)
    cv2.putText(frame, str(fps), (50, 50), cv2.FONT_HERSHEY_SIMPLEX, 1, (255,255,255), 2)
    
    cv2.imshow('frame', frame)
    
    if(cv2.waitKey(1) & 0xFF == ord('q')):
        break
    x += 1

cap.release()
cv2.destroyAllWindows()

И потом возникает ошибка:

Traceback (most recent call last):
  File "/home/user/Python/camtest.py", line 22, in <module>
    cv2.imshow('frame', frame)
cv2.error: OpenCV(4.6.0) /io/opencv/modules/highgui/src/window.cpp:1267: 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'

Я пробовал устанавливать libgtk2.0-dev и pkg-config но всё равно ошибка не пропадает


Ответы (0 шт):