mirror of
https://github.com/opencv/opencv.git
synced 2026-07-27 22:33:03 +04:00
Merge pull request #23442 from LaurentBerger:tuto_findFile
Fix image loading in tutorials code #23442 Fixes https://github.com/opencv/opencv/issues/23378 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [X] I agree to contribute to the project under Apache 2 License. - [X] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [X] The PR is proposed to the proper branch - [X] There is a reference to the original bug report and related work - [X] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [X] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
@@ -14,9 +14,9 @@ using namespace cv;
|
||||
|
||||
const char* keys =
|
||||
"{ help h| | Print help message. }"
|
||||
"{ @input1 | | Path to input image 1. }"
|
||||
"{ @input2 | | Path to input image 2. }"
|
||||
"{ @input3 | | Path to input image 3. }";
|
||||
"{ @input1 |Histogram_Comparison_Source_0.jpg | Path to input image 1. }"
|
||||
"{ @input2 |Histogram_Comparison_Source_1.jpg | Path to input image 2. }"
|
||||
"{ @input3 |Histogram_Comparison_Source_2.jpg | Path to input image 3. }";
|
||||
|
||||
/**
|
||||
* @function main
|
||||
@@ -25,9 +25,10 @@ int main( int argc, char** argv )
|
||||
{
|
||||
//! [Load three images with different environment settings]
|
||||
CommandLineParser parser( argc, argv, keys );
|
||||
Mat src_base = imread( parser.get<String>("input1") );
|
||||
Mat src_test1 = imread( parser.get<String>("input2") );
|
||||
Mat src_test2 = imread( parser.get<String>("input3") );
|
||||
samples::addSamplesDataSearchSubDirectory( "doc/tutorials/imgproc/histograms/histogram_comparison/images" );
|
||||
Mat src_base = imread(samples::findFile( parser.get<String>( "@input1" ) ) );
|
||||
Mat src_test1 = imread(samples::findFile( parser.get<String>( "@input2" ) ) );
|
||||
Mat src_test2 = imread(samples::findFile( parser.get<String>( "@input3" ) ) );
|
||||
if( src_base.empty() || src_test1.empty() || src_test2.empty() )
|
||||
{
|
||||
cout << "Could not open or find the images!\n" << endl;
|
||||
|
||||
Reference in New Issue
Block a user