How can one display an image using cv2 in Python

you can follow following code

import cv2
# read image 
image = cv2.imread('path to your image')
# show the image, provide window name first
cv2.imshow('image window', image)
# add wait key. window waits until user presses a key
cv2.waitKey(0)
# and finally destroy/close all open windows
cv2.destroyAllWindows()

I think your job is done then


As far as I can see, you are doing it almost good. There is one thing missing:

cv2.imshow('image',img)
cv2.waitKey(0)

So probably your window appears but is closed very very fast.