Merge branch 'master' of https://github.com/szmoore/MCTX3420.git
[matches/MCTX3420.git] / server / image.c
1 #include "cv.h"
2 #include "highgui_c.h"
3 #include "image.h"
4 #include <string.h>
5 #include <stdio.h>
6
7 void Image_Handler(FCGIContext * context, const char * params)
8 {
9         static CvCapture * capture = NULL;
10         if (capture == NULL)
11                 capture = cvCreateCameraCapture(0);
12         
13         static int p[] = {CV_IMWRITE_JPEG_QUALITY, 100, 0};
14
15         IplImage * frame = cvQueryFrame(capture);
16         assert(frame != NULL);
17         CvMat * jpg = cvEncodeImage(".jpg", frame, p);
18
19         // Will this work?
20         Log(LOGNOTE, "Sending image!");
21         FCGI_PrintRaw("Content-type: image/jpg\r\n\r\n");
22         //FCGI_PrintRaw("Content-Length: %d", jpg->rows*jpg->cols);
23         FCGI_WriteBinary(jpg->data.ptr,1,jpg->rows*jpg->cols);
24         
25 }

UCC git Repository :: git.ucc.asn.au