#include "cv.h" #include "highgui.h" #include int main () { // new IplImage structure 'img', using 32-bit floating point representation // over 3 channels. This constructs a colour image with blue, green and red // channels (in that order) with each colour value being a 32-bit float. IplImage *img = cvCreateImage(cvSize(100, 100), IPL_DEPTH_32F, 3); // add 'orange' data to the colour channels. int i; for (i = 0; i < img->width*img->height*3; i+=3) // over w*h*3 (channels) { ((float*)img->imageData)[i] = 0.25f; // blue channel = 64/256 ((float*)img->imageData)[i+1] = 0.75f; // green channel = 192/256 ((float*)img->imageData)[i+2] = 1.f; // red channel = 256/256 } // a visualization window is created with title 'image' cvNamedWindow ("image", 1); // img is shown in 'image' window cvShowImage ("image", img); // wait for infinite delay for a keypress cvWaitKey (0); // memory release for img before exiting the application cvReleaseImage (&img); // Self-explanatory cvDestroyWindow("image"); return (0); }