7 void Image_Handler(FCGIContext * context, char * params)
9 static CvCapture * capture = NULL;
10 if (capture == NULL) {
11 capture = cvCreateCameraCapture(0);
12 cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH, 640);
13 cvSetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT, 480);
15 static int p[] = {CV_IMWRITE_JPEG_QUALITY, 100, 0};
17 IplImage * frame = cvQueryFrame(capture);
18 assert(frame != NULL);
19 CvMat * jpg = cvEncodeImage(".jpg", frame, p);
22 Log(LOGNOTE, "Sending image!");
23 FCGI_PrintRaw("Content-type: image/jpg\r\n");
24 FCGI_PrintRaw("Cache-Control: no-cache, no-store, must-revalidate\r\n\r\n");
25 //FCGI_PrintRaw("Content-Length: %d", jpg->rows*jpg->cols);
26 FCGI_WriteBinary(jpg->data.ptr,1,jpg->rows*jpg->cols);
29 cvReleaseImageHeader(&frame);