Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Mar : Get Bitmap from webcam - tried everything

www.cryer.info
Managed Newsgroup Archive

Get Bitmap from webcam - tried everything

Subject:Get Bitmap from webcam - tried everything
Posted by:"Pascal Batzli Jr" (pascal..@terra.com.br)
Date:Mon, 21 Mar 2005 22:24:02

Hello,
I've been trying for several long hours to extract a bitmap from a webcam
using the DSPack. I've searched the Internet and Google and I wasn't able to
do it....
The SnapShot demo works, but it uses a file, not a webcam. I tried using the
ASFCAP demo, pluging in a SampleGrabber and using the code below:

procedure TVideoForm.Button1Click(Sender: TObject);
var
oBitmap: TBitmap;
begin
oBitmap := TBitmap.Create;
try
SampleGrabber1.GetBitmap(oBitmap);
oBitmap.SaveToFile('c:\teste.bmp');
finally
oBitmap.Free;
end;
end;

but I end up with an empty file. When I debug into de GetBitmap method, the
problem happens at the following line:

hr := SampleGrabber.GetConnectedMediaType(MediaType);

The hr returns -2147220983, with on MSDN shows the following error:

VFW_E_NOT_CONNECTED The operation cannot be performed because the pins are
not connected.

I noticed that the SampleGrabber has an InputPin and an OutputPin, but I
don't know what to set them to...

As you can see, I've done my homework, and I really tried... could someone
please lend me a hand....

Thank you very much in advance.

Pascal

Replies:

www.cryer.info
Managed Newsgroup Archive