Opencv imshow doesn’t prompt window showing the image

  opencv, python

I’ve been using opencv for a while and never had any problems until today.
Here is the code I use trying to show the image:

img = cv2.imread('im0.png')
cv2.imshow("CTest", img)

What I tried & what I know:

  • checked the relative and absolute path of the image, it’s fine
  • printed the image array – it works
  • tried displaying the image using matplotlib – it works
  • changed cv.2waitKey(0) to cv2.waitKey(1000) just to see – nothing happens
  • the opencv cv2.imread works

When running my code, Python is started but no window/image appears…

I’ve been through every question and forum similar to mine and I still don’t know what’s wrong.
I am using PyCharm and Python version 3.9.0 on a Mac running BigSur 11.0.1, the opencv version is 4.4.0.

I have deleted and reinstalled both Python and PyCharm and Opencv, it doesn’t work.

Anyone knows what the problem might be?

Source: Python Questions