OpenCV image display
Hello World!
I have been very interested in OpenCV for a while now, but never bothered getting it. I ended up downloading it through pip, making sure I had numpy, matplotlib, and the cv2 modules working. I tried running a very simple program:
from __future__ import print_function
import cv2 as cv
src1 = cv.imread(cv.samples.findFile('LinuxLogo.jpg'))
src2 = cv.imread(cv.samples.findFile('WindowsLogo.jpg'))
however I get this error:
Traceback (most recent call last):
File
"C:/Users/•••••••••/Documents/Python_Programs/adding_images.py",
line 5, in <module>
src1 = cv.imread(cv.samples.findFile('LinuxLogo.jpg'))
cv2.error: OpenCV(4.4.0)
C:\Users\appveyor\AppData\Local\Temp\1\pip-req-build-m5rt9vz0\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'
I think what may be happening here is that this module was set up on the user appveyor and it doesn't work on my computer? Or, (probably more likely) something completely different. Either way, any help is greatly appreciated! (Note:Open CV version is up to date, python 3 is used)
I guess you should forget samples.findFile and just call imread with your own path to any file you wish to open, unless you have a specific need to open that logo, that way...
see https://answers.opencv.org/question/2...
mvuroi what would be the syntax to do that?
I saw the documentation about the .findFile part but not sure how to use it.
Both @berak, @mvuori and @sturkmen are pointing wrong