Récupérer "les composantes RGB d'une frame"

Ben-The Hurricane

Membre enregistré
5 Novembre 2003
5
0
Lyon
Bonjour,

Je suis en train de faire un programme de traitement d’image en C/C++ pour mes études.
À l'heure actuelle, je réussi à "récupérer" le flux de ma web-cam et à afficher la vidéo qui provient de celle-ci (grâce à QuickTime). J'aimerais pouvoir récupérer chaque frame de cette vidéo, et extraire les composantes RGB de chaque pixel. Comment puis-je faire cela ?

Merci pour votre aide,
Ben

PS : Ci-joint mon code

///////
void mainWebCam()
{

InitCursor();
// Initialize QuickTime
EnterMovies();


//Variable
ComponentResult result = noErr;
SeqGrabComponent seqGrab = NULL;
SGChannel VideoChannel=0;
WindowRef maFenetre = NULL;
Rect maFenetreRect;
Rect activeVideoRect;

seqGrab = OpenDefaultComponent(SeqGrabComponentType, 0);
if (seqGrab != 0)
{
// initialize the default sequence grabber component
result = SGInitialize(seqGrab);
if(result == noErr)
{
SetRect(&maFenetreRect,50,50,50+320 + 520 ,50+480 + 60);
CreateNewWindow(kDocumentWindowClass,(kWindowStandardDocumentAttributes | kWindowStandardHandlerAttribute | kWindowCloseBoxAttribute), &maFenetreRect, &maFenetre);
ShowWindow(maFenetre);
SetPortWindowPort(maFenetre);

// set its graphics world to the specified window
result = SGSetGWorld(seqGrab,(CGrafPtr) GetWindowPort(maFenetre), NULL);

// Create a video channel
result = SGNewChannel(seqGrab, VideoMediaType, &VideoChannel);
if(result == noErr)
{
result = SGGetSrcVideoBounds (VideoChannel, &activeVideoRect);
short width = (activeVideoRect.right - activeVideoRect.left) / 2;
short height = (activeVideoRect.bottom - activeVideoRect.top) / 2;
SizeWindow(maFenetre, width, height, false);

SGSetChannelUsage (VideoChannel, seqGrabPreview);
Rect portRect;
GetPortBounds(GetWindowPort(maFenetre), &portRect);
result = SGSetChannelBounds (VideoChannel, &portRect);
SGStartPreview (seqGrab);
do
{
SGIdle (seqGrab);
RgnHandle updateRgn;
updateRgn = NewRgn();

GetWindowRegion(maFenetre, kWindowUpdateRgn, updateRgn);

SGUpdate(seqGrab, updateRgn);
DisposeRgn(updateRgn);

BeginUpdate (maFenetre);
EndUpdate (maFenetre);
}
while (true);
}
}
}
}
//////////