Ask Your Question
0

cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:627: error: (-2:Unspecified error) The function is not implemented

asked 2019-06-25 03:02:49 -0600

debcdac gravatar image

updated 2019-06-25 03:17:31 -0600

LBerger gravatar image

(While running this code I am getting this error , I am using windows10 Pro 6bit OS)

import numpy as np
import cv2

img = cv2.imread('messi5.jpg',0)
cv2.imshow('image',img)
k = cv2.waitKey(0)
if k == 27:         # wait for ESC key to exit
    cv2.destroyAllWindows()
elif k == ord('s'): # wait for 's' key to save and exit
    cv2.imwrite('messigray.png',img)
    cv2.destroyAllWindows()

Traceback (most recent call last): File "C:\Users\DEBASISH\AppData\Local\Programs\Python\Python36\Projects\read_image.py", line 5, in <module> cv2.imshow('image',img) cv2.error: OpenCV(4.1.0) C:\projects\opencv-python\opencv\modules\highgui\src\window.cpp:627: 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'

(While running this code I am getting this error , I am using windows10 Pro 6bit OS)

edit retag flag offensive close merge delete

Comments

what did you install there, and from where ?

this problem should not exist on windows.

berak gravatar imageberak ( 2019-06-25 06:20:37 -0600 )edit

yes right but for the first time i faced such issues, in my earlier installation in office Desktop, i had not faced such issues this issue i faced while installing in my laptop. and issue was resolved just by re-installing opencv-python using pip command

debcdac gravatar imagedebcdac ( 2019-06-28 12:59:42 -0600 )edit

same problem on Ubuntu 18 , wtf. That worked though. Only took me 2 days, like 12 hours.

yukon456 gravatar imageyukon456 ( 2019-07-11 20:54:59 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
-2

answered 2020-01-17 01:30:10 -0600

RAHIL gravatar image

updated 2020-01-17 01:33:46 -0600

You can either do sudo pip install opencv-contrib-python or use pyplot.imsave() instead of cv2.imwrite()

edit flag offensive delete link more

Comments

please read the question again. it's NOT about cv.imwrite()

berak gravatar imageberak ( 2020-01-17 01:48:42 -0600 )edit

follow the first command sudo pip install opencv-contrib-python

RAHIL gravatar imageRAHIL ( 2020-01-17 02:02:12 -0600 )edit

@RAHIL. @berak is telling you that is not coming from imwrite. It is coming from imshow The imshow is not pop-up. The correct way to get imshow working is installed install libgtk2.0-dev and pkg-config in order to get imshow working. That is 627: error:

supra56 gravatar imagesupra56 ( 2020-01-17 09:16:18 -0600 )edit
-2

answered 2019-06-28 13:01:45 -0600

debcdac gravatar image

This issue can be resolved by re-installing opencv-python by running from command prompt

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-06-25 03:02:49 -0600

Seen: 15,335 times

Last updated: Jan 17 '20