I followed the manual on this page, but nothing seems to happen when the line cv2.drawContours(im,contours,-1,(0,255,0),3) . I expected to see star.jpg with a green outline, as shown in the manual. Here is my code:
import numpy as np import cv2 im = cv2.imread('C:\Temp\ip\star.jpg') print im.shape
There are no error messages. star.jpg is a star from the above web page. I am using opencv version 2.4.8 and Python 2.7.
Should drawContours display an image on my screen? If so, what did I do wrong? If not, how can I show the image?
thanks
Edit:
Adding the following lines will show the image:
cv2.imshow("window title", im) cv2.waitKey()
waitKey () is necessary, otherwise the window will simply show a gray background. According to this post , this is because waitKey () tells it to start processing the WM_PAINT event.
python opencv
King long tse
source share