Ask Your Question
0

If you use the openCV library for programming on the desktop, how to display the image on the screen (window)?

asked 2013-11-02 04:21:10 -0600

Astrgan gravatar image

updated 2013-11-02 05:57:26 -0600

berak gravatar image

If you use the openCV library for programming on the desktop, how to display the image on the screen (window)?

P.S Sorry,my english is bad

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2013-11-02 05:24:04 -0600

stereomatching gravatar image

updated 2013-11-02 05:26:05 -0600

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

edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-11-02 04:21:10 -0600

Seen: 202 times

Last updated: Nov 02 '13