Can't see image in Python cv

Question: I’m trying to output an image using cv2.imshow. It doesn’t seem to work cause I can’t see an output or it’s not showing.

Repl link: https://replit.com/@CookieManster/Python-OpenCV#cv%20projects/testing1.py

import cv2

# Load an image
img = cv2.imread('epic.jpg')

# Display the image
cv2.imshow('Image', img)

cv2.waitKey(0)
cv2.destroyAllWindows()

Hello @samanthaleigarc and welcome to the community!

The link you provided to your repl lead to a 404 page, are you sure you got the right link or is your repl set to private? You can see how to share your code in the post below:

Edit: I just found your repl
https://replit.com/@CookieManster/Python-OpenCV?v=1#main.py

3 Likes

Now, about your problem.

I don’t think Replit supports cv2.imshow… (needs to be confirmed)
You can try use the file viewer to see the file manually. Or instead of displaying images with cv2.imshow, you save them using cv2.imwrite and then view them after that.

Or

You could display the image in a web format using HTML and Python frameworks like Flask or Django.

4 Likes