[code]
int main()
{
CvCapture *capture;
IplImage *frame;
char AviFileName[]="G:\\movie.mkv";
capture = cvCaptureFromAVI(AviFileName);
//cvNamedWindow("AVI player",0);
char name[100];
int cnt =0 ;
while(true)
{
if(cvGrabFrame(capture))
{
frame=cvRetrieveFrame(capture);
//cvShowImage("AVI player",frame);
sprintf(name,"G:/outputFile/%d.jpg",cnt);
if((cnt%200) == 0)
SaveImg(name,frame);
memset(name,0,100);
if(cvWaitKey(10)>=0)
break;
cnt++;
}
else
{
break;
}
}
cvReleaseCapture(&capture);
cvDestroyWindow("AVI player");
}
[/code]
[code]
void printSub(int data[],int heigth, int width){
for(int i = 0 ;i < heigth ;i++){
for(int j = 0 ;j < width ;j++){
printf("%d ",data[(i*width)+j]);
}
printf("\n");
}
printf("\n");
}
void SaveImg(char filename[],IplImage* img){
// Write the image to a file with a different name
if( !cvSaveImage(filename, img) )
{
fprintf(stderr, "failed to write image file\n");
}
}
int openMyFile1(char *filename,double outData_norm[]) {
FILE *file = fopen(filename, "w");
if(!file) {
puts("cant read");
return 1;
}
//printf("%d\n",sizeof(outData)/sizeof(int));
for(int i = 0 ; i < 10;i++){
fprintf(file,"%f ",outData_norm[i]);
}
fclose(file);
return 0;
}
int openMyFile(char *filename,double outData_norm[]) {
FILE *file = fopen(filename, "w");
if(!file) {
puts("cant read");
return 1;
}
//printf("%d\n",sizeof(outData)/sizeof(int));
for(int i = 0 ; i < 512;i++){
for(int j = 0 ; j < 512;j++){
fprintf(file,"%f ",outData_norm[i*512+j]);
}
fprintf(file,"\n");
}
fclose(file);
return 0;
}
[/code]
int main()
{
CvCapture *capture;
IplImage *frame;
char AviFileName[]="G:\\movie.mkv";
capture = cvCaptureFromAVI(AviFileName);
//cvNamedWindow("AVI player",0);
char name[100];
int cnt =0 ;
while(true)
{
if(cvGrabFrame(capture))
{
frame=cvRetrieveFrame(capture);
//cvShowImage("AVI player",frame);
sprintf(name,"G:/outputFile/%d.jpg",cnt);
if((cnt%200) == 0)
SaveImg(name,frame);
memset(name,0,100);
if(cvWaitKey(10)>=0)
break;
cnt++;
}
else
{
break;
}
}
cvReleaseCapture(&capture);
cvDestroyWindow("AVI player");
}
[/code]
[code]
void printSub(int data[],int heigth, int width){
for(int i = 0 ;i < heigth ;i++){
for(int j = 0 ;j < width ;j++){
printf("%d ",data[(i*width)+j]);
}
printf("\n");
}
printf("\n");
}
void SaveImg(char filename[],IplImage* img){
// Write the image to a file with a different name
if( !cvSaveImage(filename, img) )
{
fprintf(stderr, "failed to write image file\n");
}
}
int openMyFile1(char *filename,double outData_norm[]) {
FILE *file = fopen(filename, "w");
if(!file) {
puts("cant read");
return 1;
}
//printf("%d\n",sizeof(outData)/sizeof(int));
for(int i = 0 ; i < 10;i++){
fprintf(file,"%f ",outData_norm[i]);
}
fclose(file);
return 0;
}
int openMyFile(char *filename,double outData_norm[]) {
FILE *file = fopen(filename, "w");
if(!file) {
puts("cant read");
return 1;
}
//printf("%d\n",sizeof(outData)/sizeof(int));
for(int i = 0 ; i < 512;i++){
for(int j = 0 ; j < 512;j++){
fprintf(file,"%f ",outData_norm[i*512+j]);
}
fprintf(file,"\n");
}
fclose(file);
return 0;
}
[/code]