1 | initial version |
Try running cv.imread(args.input)
instead of cv.imread(cv.samples.findFile(args.input))
or pass an image path with the parameter --input [SOME_IMAGE]
and see if that works. If you get other errors than something with your project setup is wrong (see below).
There is a specific setup you have to do to get OpenCV up and running with python. And that doesn't guarantee that it will work properly. You have to get the right version of OpenCV, the equivalent python version and the right installation way. E.g. the wrapper packages of opencv for python (pip install opencv-python
) are causing unexpected errors with python 3.
You probably executed a tutorial script that uses sample files from predefined sample directories (see also in documentation the environment variables).
In the tutorial they are using a sample file LinuxLogo.jpg
that can't be found in your working directory / sample directory. Maybe because you probably haven't define a sample directory at all?
You might get further errors even when you fix this error (e.g. I get null window handler errors when running with pip install opencv-python
package and AttributeError: module 'cv2' has no attribute 'samples'
when running with apt install libopencv-dev python3-opencv
). The latter error is easy to fix, just remove the cv.samples.findFile()
and directly pass your args.input
variable. The first however seems to be a version incompatibility that causes unexpected errors with window elements.