11.07.2015 Views

Download document (10.35 MB) - Escuela Superior de Informática ...

Download document (10.35 MB) - Escuela Superior de Informática ...

Download document (10.35 MB) - Escuela Superior de Informática ...

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

164 Capítulo D. Código fuente43 /* Hacemos tantas copias <strong>de</strong> la imagen como44 procesamientos diferentes queramos hacer. */45 if( !frame_copy) {46 frame_copy =47 cvCreateImage( cvSize(frame->width,frame->height),48 IPL_DEPTH_8U, frame->nChannels );49 }5051 if( !imageAdquisition) {52 imageAdquisition =53 cvCreateImage( cvSize(frame->width,frame->height),54 IPL_DEPTH_8U, frame->nChannels );55 }5657 if( frame->origin == IPL_ORIGIN_TL ) {58 cvFlip( frame, frame_copy, 0 );59 cvFlip( frame, imageAdquisition, 0 );60 }61 else {62 cvFlip( frame, frame_copy, 0 );63 }6465 //Se aplica el algoritmo <strong>de</strong> L-K mejorado.66 calcularOpticalFlow(frame);67 c = cvWaitKey(25);6869 }//fin else frame70 }//fin for7172 cvReleaseCapture(&capture);73 cvReleaseImage(&frame_copy);74 cvReleaseMemStorage(&storage);75 caraInicialized = 0;76 free_memory();7778 }79 else {80 free_memory();81 }8283 if(ficheroMARCAS != NULL)84 fclose(ficheroMARCAS);85 if(ficheroGFACIALES != NULL)86 fclose(ficheroGFACIALES);8788 return 0;89 }9091 /**********************************************************************92 * Funcion: calcularOpticalFlow93 * Descripcion: Implementación <strong>de</strong>l algoritmo <strong>de</strong> Lucas-Kana<strong>de</strong>.94 * Entradas: frame_optical_flow --> Puntero a Imagen a analizar.95 * Salidas: nada.96 *********************************************************************/97 void calcularOpticalFlow(IplImage *frame_optical_flow){9899 int i, k;// c;100101 if( !imageOF )102 {

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!