bonjour !
je me sers de la librairie allegro 4.2 couplée à OpenLayer (un wrapper OpenGl pour allegro).

je ne me sers donc pas de la partie fenetres de la higui.

je n arrive pas à recopier le flux récupéré par cvGrabFrame.

quelqu un peut il m aider ?

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
84
85
86
87
88
89
 
#include <allegro.h>
#include <OpenLayer.hpp>
#include "stdio.h"
#include <loadpng.h>
using namespace ol;
 
#include "cv.h"
#include "highgui.h"
 
BITMAP *video_image;// my transition of data image
 
CvCapture* g_capture = NULL; //openCV specific structures
IplImage* img;
 
int Init_Video()
{
g_capture =  cvCreateCameraCapture(0);
cvQueryFrame(g_capture); 
 
int x_capt=(int) cvGetCaptureProperty(g_capture, CV_CAP_PROP_FRAME_HEIGHT);
int y_capt=(int) cvGetCaptureProperty(g_capture, CV_CAP_PROP_FRAME_WIDTH);
video_image=create_bitmap(x_capt,y_capt);// adjusting the allegro bitmap to camera size
sprintf(string_Last_Order,">>Camera Opened Size x: %d y: %d", x_capt,y_capt);
camera_is_on=1;
return(0);   
}
 
 
int CloseVideo()
{
 cvReleaseCapture(&g_capture);
 sprintf(string_Last_Order,">>Camera Closed");
 camera_is_on=0;
 return(0);   
}
 
int Print_Video()
{
if(camera_is_avaible==1)
{
 if(!cvGrabFrame(g_capture)){              // capture a frame 
  sprintf(string_Last_Order,"Could not grab a frame ");
  }
img=cvRetrieveFrame(g_capture);
 
cvCopy( img, video_image, 0);  
 
Bitmap myFakeBmp( video_image, true);
setting: Blenders:: Push(); Blenders::Set(GL_ONE, GL_ZERO);
myFakeBmp.Blit(videoX, videoY);
Blenders:: Pop();
}     
else if (camera_is_avaible==0){petitchiffre.Print("No video stream available!",WindowVideoX+20,WindowVideoY+90);}
return(0);
}
 
int main() {
 
   Setup::SetupProgram(KEYBOARD | MOUSE); 
   Setup::SetupScreen( largeur_ecran, hauteur_ecran,WINDOWED, 16 );
   Settings::SetAntialiasing( true );
   install_timer();
 
   LOCK_VARIABLE(ticks);
   LOCK_FUNCTION(ticker);
   install_int_ex(ticker , ticker_rate);
 
   InitVideo();  
 
 if(set_display_switch_mode(SWITCH_BACKGROUND))
 {set_display_switch_mode(SWITCH_BACKAMNESIA);}
 
 while(index_quit!=1)
 {    
    while(ticks == 0) {rest(1);}
    ticks_passed = ticks;
    ticks = 0;
 
    Canvas::Fill(CouleurFond);
    Print_Video();
    Canvas::Refresh();
 
}
CloseVideo();
remove_timer();
return 0;
}
END_OF_MAIN()