bonjour à tous...

j ai un vrai problème avec Ocv 1.0 pour fixer la vitesse d'enregistrement du fichier avi ! toujours le meme frame rate ! j ai cru comprendre qu il etait du a la camera video. cependant j ai beau tente de le regler rien ne se passe....

y a t il un moyen d acceder à une fentre de paramétrage ?

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
 
#include "cv.h"
#include "highgui.h"
#include "stdio.h"
#include "dirent.h"
#include "conio.h"
#include "iostream"
 
int g_slider_position=0;
CvCapture* g_capture = NULL;
IplImage* frame;
IplImage* frameplayer;
int camera_rate=25;
int video_rate=25;
using namespace std;
 
 
int main( int argc, char** argv)
{
 
cout<<"Opening\n";
g_capture= cvCaptureFromCAM( 0 );
frame = cvQueryFrame(g_capture);// a mettre absolument avant getsize, initialise les valeurs
cvSetCaptureProperty( g_capture,CV_CAP_PROP_FPS, camera_rate  );
int cx_size=(int)cvGetCaptureProperty( g_capture, CV_CAP_PROP_FRAME_WIDTH) ;
int cy_size=(int)cvGetCaptureProperty( g_capture, CV_CAP_PROP_FRAME_HEIGHT)  ;
 
 
cout<<"Format camera x "<< cx_size << "  y " << cy_size;
cout<<"\nBPS rate: "<< camera_rate;
frame    = cvCreateImage(cvSize(cx_size,cy_size), 8  ,3);// 8 bits 3 couches color
CvVideoWriter *writer =cvCreateVideoWriter("out.avi",-1,camera_rate,cvSize(cx_size,cy_size),3);
cvNamedWindow("EnregistrementOK",CV_WINDOW_AUTOSIZE); 
 
 
 
 while(1)
 {
  frame = cvQueryFrame(g_capture);
  if(!frame) break;
  cvShowImage("EnregistrementOK",frame);     
  cvWriteFrame(writer,frame);  
  char c=cvWaitKey(1000/camera_rate);
  if(c==27) break;
  }
 
 
 cvReleaseCapture(&g_capture);
 cvReleaseVideoWriter(&writer);
 cvDestroyWindow("EnregistrementOK");  
 
 
 
 
 CvCapture* capture=cvCaptureFromAVI("out.avi");
 frameplayer=cvQueryFrame(capture);
 int videox_size=(int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH) ;
 int videoy_size=(int)cvGetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT)  ;
 
 cvSetCaptureProperty( capture, CV_CAP_PROP_FPS, video_rate)  ;
 
 long l = (long)cvGetCaptureProperty(capture, CV_CAP_PROP_FOURCC);
 char *fourcc = (char *) (&l);
 cout<<"\nfourcc = " << fourcc[3]<< fourcc[2]<< fourcc[1]<< fourcc[0];
 cout<<"\nFormat video x "<< videox_size << " video y " << videoy_size;
 cout<<"\nBPS rate: "<< video_rate;
 
 frameplayer    = cvCreateImage(cvSize(videox_size,videoy_size), 8  ,3);// 8 bits 3 couches color
 cvNamedWindow("Lecture",CV_WINDOW_AUTOSIZE);
 
while(1)
{
 
 frameplayer=cvQueryFrame(capture);
  cvShowImage("Lecture",frameplayer);  
  char c=cvWaitKey(33);
  if(c==27) break;
}      
 
 cvReleaseCapture(&capture);
 cvDestroyWindow("Lecture");   
 return(0);
}