I will like to split the video into frame of images and then save them into a file. when compiling the code the following error apear: undefined reference to itoa and strcat. Any help?
Thanks
the code is the following:
#include <stdio.h>
#include <stdlib.h>
#include "cv.h"
#include <highgui.h>
#include "cxcore.h"
int main( int argc, char** argv )
{
CvCapture *capture = cvCaptureFromAVI("xyz.avi");
if(!capture)
{
printf("!!! cvCaptureFromAVI failed (file not found?)\n");
return -1;
}
int fps = (int) cvGetCaptureProperty(capture, CV_CAP_PROP_FPS);
printf("* FPS: %d\n", fps);
IplImage* frame = NULL;
int frame_number = 0;
char key = 0;
while (key != 'q')
{
// get frame
frame = cvQueryFrame(capture);
if (!frame)
{
printf("!!! cvQueryFrame failed: no frame\n");
break;
}
char filename[100];
strcpy(filename, "frameSplit");
char frame_id[30];
itoa(frame_number, frame_id, 10);
strcat(filename, frame_id);
strcat(filename, ".png");
printf("* Saving: %s\n", filename);
if (!cvSaveImage(filename, frame,0))
{
printf("!!! cvSaveImage failed\n");
break;
}
frame_number++;
// quit when user press 'q'
key = cvWaitKey(1000 / fps);
}
// free resources
cvReleaseCapture(&capture);
return 0;
}