'opencv tutorial problem with samples::findFile()
when I'm trying to run this tutorial
I'm getting this problem on samples::findFile()
I tried to #include <opencv2/core/utility.hpp>
but same problem, any idea?
I'm getting this errors:
#include "opencv2/imgcodecs.hpp"
#include "opencv2/highgui.hpp"
#include <iostream>
using namespace cv;
// we're NOT "using namespace std;" here, to avoid collisions between the beta variable and std::beta in c++17
using std::cin;
using std::cout;
using std::endl;
int main(void)
{
double alpha = 0.5; double beta; double input;
Mat src1, src2, dst;
cout << " Simple Linear Blender " << endl;
cout << "-----------------------" << endl;
cout << "* Enter alpha [0.0-1.0]: ";
cin >> input;
// We use the alpha provided by the user if it is between 0 and 1
if (input >= 0 && input <= 1)
{
alpha = input;
}
src1 = imread(samples::findFile("LinuxLogo.jpg"));
src2 = imread(samples::findFile("WindowsLogo.jpg"));
if (src1.empty()) { cout << "Error loading src1" << endl; return EXIT_FAILURE; }
if (src2.empty()) { cout << "Error loading src2" << endl; return EXIT_FAILURE; }
beta = (1.0 - alpha);
addWeighted(src1, alpha, src2, beta, 0.0, dst);
imshow("Linear Blend", dst);
waitKey(0);
return 0;
}
Solution 1:[1]
I installed OpenCV using this tutorials (pre-build version)
and when I tried to go over the introduction I got errors on the "blending two images" tutorial, specific with the samples::findFile()
The problem was fixed by changing the version from 3.5.3 to 4.5.3. don't forget to change the property part too, according to this steps
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |