camara_y_video

Manejo de cámara y video  code format="c" /*Código de ejemplo: Francisco Carlos Calderón Libre de modificar difundir y aprender 2009        */
 * 1) include "cv.h"
 * 2) include "highgui.h"

int main(int argc, char** argv) {   int key=-1; CvCapture* capture = 0; if( argc == 1 || (argc == 2 && strlen(argv[1]) == 1 && isdigit(argv[1][0]))) capture = cvCaptureFromCAM( argc == 2 ? argv[1][0] - '0' : 0 ); else if( argc == 2 ) capture = cvCaptureFromAVI( argv[1] ); cvNamedWindow("Imagen",0); if( !capture ) {       fprintf(stderr,"No se pudo iniciar.\n"); return -1; }

IplImage* videoFrame = NULL; videoFrame = cvQueryFrame(capture); if(!videoFrame) {       printf("mal cuadro \n"); exit(0); }

while(key != 'q') {       videoFrame = cvQueryFrame(capture); cvShowImage("Imagen",videoFrame); key = cvWaitKey(10); }   cvReleaseCapture(&capture); return 0; } code