I decided to touch openCV in class, so first install. By the way, mac, Python 3.7.4
pip install opencv-python
Then, create test.py that just displays the image.
test.py
import cv2
img = cv2.imread('mona.jpg')
cv2.imshow('image', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Although the image was displayed when executed,
objc[62826]: Class RunLoopModeTracker is implemented in both /Users/username/.pyenv/versions/anaconda3-2019.10/lib/python3.7/site-packages/cv2/.dylibs/QtCore (0x1139e97f0) and /Users/username/.pyenv/versions/anaconda3-2019.10/lib/libQt5Core.5.9.7.dylib (0x128195a80). One of the two will be used. Which one is undefined.
QObject::moveToThread: Current thread (0x7fc0f7435300) is not the object's thread (0x7fc0f9f02cc0).
Cannot move to target thread (0x7fc0f7435300)
You might be loading two sets of Qt binaries into the same process. Check that all plugins are compiled against the right Qt binaries. Export DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.
QObject::moveToThread: Current thread (0x7fc0f7435300) is not the object's thread (0x7fc0f9f02cc0).
Cannot move to target thread (0x7fc0f7435300)
(Omitted)
Documents similar to "You might be-" follow in a row in the abbreviation. Even though the image is displayed, I'm worried about it.
After a little research, I found a similar case at here.
"If multiple packages have GUI functions, you can install the ver without GUI functions from Mazui." It seems that opencv-python-headless, which has no GUI function, should be installed.
pip install opencv-python-headless
Hundreds of mysterious lines disappeared safely. Rest assured. By the way, if you enter the keyboard with the image selected, it will end.
However, the site that seems to be official says that you have to install only one appropriate one, so uninstall opencv-python.
pip uninstall opencv-python
Then, it seems that the necessary headless was also uninstalled, so install it again.
pip install opencv-python-headless
That's it.
Recommended Posts