samples.findfile for loading photos
Hello, I've downloaded openCV for python and am using it on Microsoft Visual Studio and am trying to use the tutorials. Often, they fetch a picture,
src2 = cv.imread(cv.samples.findFile('LinuxLogo.jpg'))
The program runs, but gives an error:
Message=OpenCV(4.1.1) C:\projects\opencv-python\opencv\modules\core\src\utils\samples.cpp:62: error: (-2:Unspecified error) OpenCV samples: Can't find required data file: LinuxLogo.jpg in function 'cv::samples::findFile'
Source=C:\Users\tiern\source\repos\OpenCV-Dilation\OpenCV_Dilation.py
StackTrace:
File "C:\Users\tiern\source\repos\OpenCV-Dilation\OpenCV_Dilation.py", line 48, in <module>
src = cv.imread(cv.samples.findFile(args.input))
If you could explain how I could load in pictures, I would greatly appreciate it.
Thank you!
what exactly did you download and from where ? (does it even have samples / data folders ?)
it probably works great, if you run the sample code from a plain cmdline, not an ide, where you have no control over the startup path.
-I've downloaded it from pip. -It does have a sample folder, and it does have a data folder which contains all pictures specified.
I ran this from a command line and it worked much better. For the erosion and dilation demo it did sort of worked when I entered the code. It created two windows, and each of them had two sliders like in the demo, however, it did not load the picture that was supposed to be in the window.
did you read the documentation
What do you mean?
Are you using namespace
import argparse
?