Ask Your Question

Revision history [back]

click to hide/show revision 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.

#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.