#include "cv.h" #include "highgui.h" #include #include #define NUMBER 100 #define DELAY 5 int main( int argc, char** argv ) { // Set up variables CvFont font; CvPoint pt; CvScalar colour; CvSize text_size; char window_name[] = "Hello World!"; int line_type = CV_AA; // change it to 8 to see non-antialiased graphics int width = 1000, height = 700; // Create an image IplImage* image = cvCreateImage( cvSize(width,height), 8, 3 ); // Create a window cvNamedWindow(window_name, 1 ); // Zero the image data cvZero( image ); // Initialise font cvInitFont( &font, 4, 8.0, 8.0, 0, line_type ); // Set colour colour = CV_RGB(0, 0, 192); // Set location of text pt.x = 150; pt.y = 250; // Add text to image cvPutText( image, "Hello", pt, &font, colour); pt.x = 75; pt.y = 600; cvPutText( image, "World!", pt, &font, colour); // Display image cvShowImage(window_name, image); // Wait for a key stroke, then release memory and exit cvWaitKey(0); cvReleaseImage(&image); cvDestroyWindow(window_name); return 0; }