X-Git-Url: https://git.ucc.asn.au/?p=matches%2FMCTX3420.git;a=blobdiff_plain;f=server%2Fimage.c;h=dcc122d28f27ce323eb525217d3a83f6b36e0d53;hp=a32ac2cdcb7996bc1f072cb536312ff95a9812da;hb=7547dad3aee722136894566bb6802fe6491cbfbe;hpb=b76203e2a2b29a4e2f9e8db7ae399e6e32570715 diff --git a/server/image.c b/server/image.c index a32ac2c..dcc122d 100644 --- a/server/image.c +++ b/server/image.c @@ -10,6 +10,7 @@ static int g_captureID = -1; void Image_Handler(FCGIContext * context, char * params) { + int num = 0, width = 1600, height = 1200; // Set Default values FCGIValue val[] = { {"num", &num, FCGI_INT_T}, @@ -74,18 +75,22 @@ void Image_Handler(FCGIContext * context, char * params) g_captureID = num; } - cvSetCaptureProperty(g_capture, CV_CAP_PROP_FRAME_WIDTH, width); - cvSetCaptureProperty(g_capture, CV_CAP_PROP_FRAME_HEIGHT, height); + if (g_capture != NULL) + { + + cvSetCaptureProperty(g_capture, CV_CAP_PROP_FRAME_WIDTH, width); + cvSetCaptureProperty(g_capture, CV_CAP_PROP_FRAME_HEIGHT, height); - *frame = cvQueryFrame(g_capture); - result = (*frame != NULL); + *frame = cvQueryFrame(g_capture); + result = (*frame != NULL); //cvShowImage("display", *image); //cvWaitKey(0); //cvSaveImage("test.jpg",*image,0); - Log(LOGDEBUG, "At end of mutex"); - + Log(LOGDEBUG, "At end of mutex"); + } + pthread_mutex_unlock(&mutex); //Close the mutex //NOTE: Never have a "return" statement before the mutex is unlocked; it causes deadlocks!