2

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.

1

2 Answers 2

2

This may help you:

pip uninstall opencv-python

pip install --upgrade opencv-python==4.5.3.56
Sign up to request clarification or add additional context in comments.

Comments

1

This was a known issue in opencv-python package. Please upgrade to the 4.4.0.42 release. For details, check this issue in OpenCV issue tracker: https://github.com/opencv/opencv/issues/18079

3 Comments

It's happening for me on ubuntu 21.10, python3.9.7 and opencv-python 4.5.4.58
I had similar problem on Ubuntu 21.10 and Python3.9 and solved it by downgrading to 4.5.3.56
Known issue in the latest release, see: github.com/opencv/opencv-python/issues/572

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.