I'm following this tutorial to make corner detection and I have to use cv2.imshow. Here is my code:
import cv2
import numpy as np
filename = '1.jpg'
img = cv2.imread(filename)
gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
gray = np.float32(gray)
dst = cv2.cornerHarris(gray,2,3,0.04)
#result is dilated for marking the corners, not important
dst = cv2.dilate(dst,None)
# Threshold for an optimal value, it may vary depending on the image.
img[dst>0.01*dst.max()]=[0,0,255]
cv2.imshow('dst',img)
I got this error:
OpenCV Error: Unspecified error (The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon support. If you are on Ubuntu or Debian, install libgtk2.0-dev and pkg-config, then re-run cmake or configure script) in cvShowImage, file /root/mc-x86-2.7/conda-bld/opencv-3_1482254836916/work/opencv-3.1.0/modules/highgui/src/window.cpp, line 545
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
cv2.error: /root/mc-x86-2.7/conda-bld/opencv-3_1482254836916/work/opencv-3.1.0/modules/highgui/src/window.cpp:545: error: (-2) The function is not implemented. Rebuild the library with Windows, GTK+ 2.x or Carbon 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
So, I installed libgtk2.0-dev and pkg-config but it didn't solve the problem. The error message said to run cmake but where? There is no CMakeLists.txt file in my drive.
Then, I follow some answers on this website like this one: first, I downloaded OpenCV directly on the website and I run cmake, make and make install. All is okay but I still have the same error when I use Anaconda but it got another message when I open Python from /usr/bin/python:
init done
opengl support available
For the moment, I can't show my image. What I have to do?