Skip to content

Instantly share code, notes, and snippets.

@thorikawa
Created August 14, 2012 06:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thorikawa/3346985 to your computer and use it in GitHub Desktop.
Save thorikawa/3346985 to your computer and use it in GitHub Desktop.
OpenCV Hello World
#include <opencv2/opencv.hpp>
int main () {
cvNamedWindow( "My Window", 1 );
IplImage *img = cvCreateImage( cvSize( 640, 480 ), IPL_DEPTH_8U, 1 );
CvFont font;
double hScale = 2.0;
double vScale = 2.0;
int lineWidth = 5;
cvInitFont(&font, CV_FONT_HERSHEY_SIMPLEX | CV_FONT_ITALIC, hScale, vScale, 0, lineWidth);
cvPutText(img, "Hello World!", cvPoint( 100, 200 ), &font, cvScalar( 255, 255, 0 ) );
cvShowImage( "My Window", img );
cvWaitKey();
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment