Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I fix issue with no window opening with cv2.imshow?

I successfully use cv2.imread to read an image. I can display in the console using matplotlib.imshow. When I use cv2.imshow, nothing happens, no errors, no window opens. Script ends normally, but no image. I tried using different integers with cv2.waitKey() and leaving it empty, but no luck. Works great on Windows, but not on my Mac.

Using Python 2.7, Spyder 3.3.6, openCV 4.2.0

  1. import cv2
  2. import numpy as np
  3. import matplotlib.pyplot as plt
  4. img =cv2.imread('/Users/Paul/Documents/Photos/F15.jpg',cv2.IMREAD_GRAYSCALE)
  5. cv2.imshow('test',img)
  6. cv2.waitKey()
  7. cv2.destroyAllWindows()

How do I fix issue with no window opening with cv2.imshow?

I successfully use cv2.imread to read an image. I can display in the console using matplotlib.imshow. When I use cv2.imshow, nothing happens, no errors, no window opens. Script ends normally, but no image. I tried using different integers with cv2.waitKey() and leaving it empty, but no luck. Works great on Windows, but not on my Mac.

Using Python 2.7, Spyder 3.3.6, openCV 4.2.04.2.0.

  1. import cv2
  2. cv2 import numpy as np
  3. np import matplotlib.pyplot as plt
  4. plt img =cv2.imread('/Users/Paul/Documents/Photos/F15.jpg',cv2.IMREAD_GRAYSCALE)
  5. cv2.imshow('test',img)
  6. cv2.waitKey()
  7. cv2.destroyAllWindows()
=cv2.imread('/Users/Paul/Documents/Photos/F15.jpg',cv2.IMREAD_GRAYSCALE) cv2.imshow('test',img) cv2.waitKey() cv2.destroyAllWindows()

How do I fix issue with no window opening with cv2.imshow?

I successfully use cv2.imread to read an image. I can display in the console using matplotlib.imshow. When I use cv2.imshow, nothing happens, no errors, no window opens. Script ends normally, but no image. I tried using different integers with cv2.waitKey() and leaving it empty, but no luck. Works great on Windows, but not on my Mac.

Using Python 2.7, Spyder 3.3.6, openCV 4.2.0.

import cv2
import numpy as np
import matplotlib.pyplot as plt
img =cv2.imread('/Users/Paul/Documents/Photos/F15.jpg',cv2.IMREAD_GRAYSCALE)
cv2.imshow('test',img)
cv2.waitKey()
cv2.destroyAllWindows()