Error details and countermeasures that occurred in OpenCv2 when executing the object recognition sample program of "Object Detect on Tools"

Trying to recognize real-time objects using a webcam I will leave the stumbled part as a reminder. If you have a problem similar to yourself, please refer to it.

** ■ Referenced site ** I was working based on the following site, but an error occurred in the OpenCV part.

Referenced site: @ karaage0703 "Object Detection Tools, which makes it super easy to detect objects with TensorFlow, is now compatible with TensorFlow 2.x."

** ■ Error details ** <Situation 1> When I ran the object recognition sample program in ObjectDetectonTools with python, I got a runtime error with cv2.waitKey (0) of openCv saying "OpenCV is not installed".

I should have installed OpenCV, but for some reason I was getting an error saying that it was not installed.

<Situation 2> Try it with python I don't get an import error when I type "import cv2", When I hit cv2.waitKey (0) to execute it, an error occurred.

At that time, I had no idea what was happening.

** ■ Execution environment ** OS : Ubuntu 18.04.5 LTS python: python3 Use anaconda

** ■ Cause ** I don't know the exact cause, The root cause is libraries such as openCv installed with pip and anaconda. It seems that it was messed up. As a result, when I ran python3 (anaconda environment), it seems that I could not find the reference destination of openCv that I should have installed.

** ■ Solution ** ・ Delete anaconda I deleted anaconda and unified it with pip. After that, when I installed opencv etc. again, the same result as the reference site was obtained.

Recommended Posts

Error details and countermeasures that occurred in OpenCv2 when executing the object recognition sample program of "Object Detect on Tools"
Error that occurred in OpenCV3 and its solution Precautions when using OpenCV3 on Mac
A story that an error occurred when PyInstaller was used in a program that uses googleapiclient
A server that returns the number of people in front of the camera with bottle.py and OpenCV
Check the argument type annotation when executing a function in Python and make an error
Summary of points to keep in mind when writing a program that runs on Python 2.5
Through the installation of pip package that depends on opencv-python when building opencv from source code
Precautions when drawing the probability density function and the histogram on top of each other in matplotlib