程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Opencv Python debug record

編輯:Python

        This article will continue to record opencv-python Common errors and solutions during use .

1  window.cpp:1274: error: (-2:Unspecified error) The function is not implemented

        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. 

2 error: (-215:Assertion failed) iDepth == CV_8U || iDepth == CV_8S in function 'cv::connectedComponents_sub1'

        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 .


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved