1 | initial version |
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
int main()
{
cv::Mat input = cv::imread("aaa.jpg");
if(input.empty()){
std::cerr<<"can't open image"<<std::endl;
return -1;
}
cv::imshow("", input);
cv::waitKey();
}
Hope this is what you are finding, if you need a text book to study openCV, give this a try, many useful algorithms and functions are introduced by this book.
2 | No.2 Revision |
#include <iostream>
<exception>
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
int main()
{
try{
cv::Mat input = cv::imread("aaa.jpg");
if(input.empty()){
std::cerr<<"can't open image"<<std::endl;
return -1;
}
cv::imshow("", input);
cv::waitKey();
}catch(std::exception const &ex){
std::cerr<<ex.what()<<std::endl;
}
}
Hope this is what you are finding, if you need a text book to study openCV, give this a try, many useful algorithms and functions are introduced by this book.