Estoy tratando de escribir un programa para analizar expresiones emocionales como lágrimas. Como parte de mi rastreador, estoy usando OpenCV para grabar videos de muestra. Particularmente, no estoy seguro acerca de cómo elegir correctamente FPS (10FPS parece que debería funcionar). Tampoco estoy seguro de qué Códec que debo usar en OS X, he intentado todas las posibles CV_FOURCC de here también, pero devuelve el error siguiente:¿Cómo escribir un archivo de video con OpenCV?
Stream #0.0: Video: rawvideo, yuv420p, 640x480, q=2-31, 19660 kb/s, 90k tbn, 10 tbc
Assertion failed: (image->imageSize == avpicture_get_size((PixelFormat)input_pix_fmt, image->width, image->height)), function writeFrame, file /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_ports_graphics_opencv/work/OpenCV-2.2.0/modules/highgui/src/cap_ffmpeg.cpp, line 1085.
hacer que todos tienen algo de código de trabajo con cvWriteFrame? Gracias por tomarse el tiempo para ver mi problema!
Para los interesados todo el programa es:
#include <cv.h>
#include <cxcore.h>
#include <highgui.h>
int main (int argc, const char * argv[])
{
CvCapture *capture;
IplImage *img;
int key = 0;
CvVideoWriter *writer;
// initialize camera
capture = cvCaptureFromCAM(0);
// capture = cvCaptureFromAVI("AVIFile");
// always check
assert(capture);
// create a window
cvNamedWindow("video", 1);
int color = 1; // 0 for black and white
// get the frame size
CvSize size = cvSize((int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_WIDTH),(int)cvGetCaptureProperty(capture, CV_CAP_PROP_FRAME_HEIGHT));
writer = cvCreateVideoWriter(argv[1], -1 , 10 , size, color);
while(key != 'q') {
// get a frame
img = cvQueryFrame(capture);
// always check
if(!img) break;
cvWriteFrame(writer, img);
cvShowImage("video", img);
// quit if user press 'q'
key = cvWaitKey(5);
}
// free memory
cvReleaseVideoWriter(&writer);
cvReleaseCapture(&capture);
cvDestroyWindow("video");
return 0;
}
¿Qué plataforma/sistema operativo? –
¿Puede editar la pregunta para incluir el mensaje de error impreso en la consola/terminal después del SIGABRT? Esto nos ayudaría a entender más sobre el error. – speciousfool