segmentation fault in imshow in opencv python3

Viewed 3783

i have installed opencv in python by

python3 -m pip install opencv-python

i am currently on macOS 10.15.6

the pip list shows opencv-python 4.4.0.40 in list

cv2 has been imported but it is continously giving

segmentation error on the line cv2.imshow(winname="Face", mat=img)

the full code is like this

import cv2
# read the image
img = cv2.imread("/Users/abhimac/Pictures/mycutout.png")
# show the image
cv2.imshow(winname="Face", mat=img)
# Wait for a key press to exit
cv2.waitKey(delay=0)
# Close all windows
cv2.destroyAllWindows() 

the path of image has been checked , it is correct.

2 Answers

This may help you:

pip uninstall opencv-python

pip install --upgrade opencv-python==4.5.3.56
Related