This article will continue to record opencv-python Common errors and solutions during use .
This error usually appears as even the most basic cv2.imshow Can't use . The content of the error report is :window.cpp:1274: error: (-2:Unspecified error) The function is not implemented.
Traceback (most recent call last):
File “/home/data/PJS/test_bed/img_show.py”, line 18, in
cv2.imshow(‘img’, img)
cv2.error: OpenCV(4.5.3) /tmp/pip-req-build-9gwtlx3c/opencv/modules/highgui/src/window.cpp:1274: 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’
resolvent :
import cv2
print(cv2.__file__)
# Delete printed cv2 Folder is ok
# If it doesn't , Uninstall and re install opencv-python That's all right.
There was this mistake , The common reason is that the elements of the image matrix are not integers , Therefore, the error prompt related to the data format is reported .
image = image.astype(np.uint8)
More 3D 、 Please pay attention to two-dimensional perception algorithm and financial quantitative analysis algorithm “ Lele perception school ” WeChat official account , And will continue to update .