Skip to content

Instantly share code, notes, and snippets.

@apremalal
Created October 4, 2013 10:12
Show Gist options
  • Save apremalal/6823788 to your computer and use it in GitHub Desktop.
Save apremalal/6823788 to your computer and use it in GitHub Desktop.
Simple opencv application
#include <QCoreApplication>
#include <cv.h>
#include<cxcore.h>
#include <highgui.h>
#include<iostream>
using namespace std;
using namespace cv;
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
Mat image;
image = imread("<path to image file>"); // Read the file
if(image.empty()) // 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 a.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment