forked from conan-community/conan-opencv
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add tests for successful loading of image files
with image files that represent different tiff encodings
- Loading branch information
1 parent
d4f6e56
commit 947457b
Showing
6 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#include "opencv2/opencv.hpp" | ||
#include "opencv2/core/utils/logger.hpp" | ||
#include <iostream> | ||
#include <fstream> | ||
|
||
bool file_exists(const char *filepath) { | ||
std::ifstream file(filepath); | ||
return file.good(); | ||
} | ||
|
||
int main( int argc, const char** argv ){ | ||
cv::utils::logging::setLogLevel(cv::utils::logging::LOG_LEVEL_DEBUG); | ||
cv::Mat image = cv::imread(argv[1]); | ||
if(!file_exists(argv[1])) { | ||
std::cerr << "File " << argv[1] << " does not exist!\n"; | ||
return 1; | ||
} | ||
if(image.data == nullptr) { | ||
std::cerr << "Error: could not load image " << argv[1] << "\n"; | ||
return 1; | ||
} else { | ||
std::cout << "Successfully load image " << argv[1] << " of size " << image.size() << "\n"; | ||
return 0; | ||
} | ||
} |
Binary file not shown.
Binary file not shown.