Salut!!
Voici le code que j'ai réalisé pour le moment mais je ne vois pas comment y appliquer le cvSaveImage, peux -tu me mettre sur la voie stp?
Merci
#pragma comment (lib,"highgui.lib" )
#include "cv.h"
#include "highgui.h"
#include <stdio.h>
// Capture vidéo (reconnaissance caméra)
//A simple camera capture framework
int main(){
int isColor=1;
int fps=15;
int frameW=640;
int frameH=480;
IplImage* img=0;
int nFrames=50;
int i;
CvCapture* capture=cvCaptureFromCAM(CV_CAP_ANY);
if(capture){
printf("OK!!\n" );
}else{
fprintf(stderr,"ERROR: capture is NULL \n" );
getchar();
return -1;
}
//Create a window in which the captured images will be presented
cvNamedWindow("Capture caméra", CV_WINDOW_AUTOSIZE);
//Show the image captured from the camera in the window and repeat
while(1){
//Get one frame
IplImage* frame=cvQueryFrame(capture);
if(!frame){
fprintf(stderr,"ERROR:frame is null...\n" );
getchar();
break;
}
cvShowImage("Capture caméra",frame);
int c=cvWaitKey(50);
// Quand on presse ESC, l'enregistrement commence et prend le nombre d'images nFrames indiqué.
//If ESC key pressed, c=0x10001B under OpenCV 0.9.7 (linux version),
//remove higher bits using AND operator
if((c&255) == 27)
break;
CvVideoWriter* writer = cvCreateVideoWriter("c:\\out.avi", CV_FOURCC('M','J','P','G'),fps,cvSize(frameW,frameH),isColor);
for(i=0;i<nFrames;i++){
cvGrabFrame (capture);//Capture a frame
img=cvRetrieveFrame(capture);//retrieve the captured frame
cvWriteFrame(writer, img);//add the frame to the file
}
}
//Release the capture device housekeeping
cvReleaseCapture(&capture);
cvDestroyWindow("Capture caméra" );
cvReleaseVideoWriter(&writer);
return 0;
}