Ask Your Question

kchaitu's profile - activity

2016-12-29 01:46:48 -0600 received badge  Nice Question (source)
2014-12-30 00:33:36 -0600 received badge  Student (source)
2014-10-19 12:46:19 -0600 received badge  Famous Question (source)
2014-07-22 03:16:45 -0600 received badge  Notable Question (source)
2014-06-14 05:51:26 -0600 received badge  Popular Question (source)
2013-12-18 09:18:13 -0600 asked a question How to compile basic opencv program in C++ in ubuntu

I have installed opencv in ubuntu 12.04. I have written a basic program in c++. How to compile this basic program in C++ using opencv libraries.

#include <cv.h>
#include <highgui.h>


int main(){

    Mat image;
    image = imread("google.jpg", CV_LOAD_IMAGE_UNCHANGED);   // Read the file

    if(! image.data )                              // Check for invalid input
    {
        cout <<  "Could not open or find the image" << std::endl ;
        return -1;
    }

    namedWindow( "Display window", CV_WINDOW_AUTOSIZE );// Create a window for display.
    imshow( "Display window", image );                   // Show our image inside it.

    waitKey(0);   

      return 0;
}