 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Thomas G. Liesner Guest
|
Posted: Wed May 10, 2006 8:15 am Post subject: Simpliest way to just grab a single picture from a videosour |
|
|
Hello!
I'm programming with Delphi for many years, but mostly data-driven
applications. Now i need to capture a picture from any installed
video-source.
DSPack is now installed and the demo-app "PlayCap" is _nearly_ what i
need. In my case i need a 'silent' solution which means - no window with
the current camerastream visible, only capture the current picture on
command and retrieve it as data without any visual feedback.
If i set VideoWindow to invisible the camerastream i doesn't care and is
visible, if i comment out "VideoWindow.QueryInterface(IBaseFilter,
DestFilter);" a separate window with the videostream opens.
Can someone give me hints how the silent way goes?
And it's bit annoying that if i run it in the IDE i get a protection
error because of the running debugger.
TIA,
Thomas G. Liesner
--
---------------- Neue Hamster-stable 2.1.0.11 seit 28.03.2006 -----------------
Ich suche eine neue Vollzeitarbeitsstelle als Softwareentwickler (Schwerpunkt
Windows) entweder im weiteren Umkreis von Münster (Westfalen) oder in Heim-
arbeit. Details: http://www.tglsoft.de <mailto:jobsuche (AT) tglsoft (DOT) de> |
|
| Back to top |
|
 |
KimB Guest
|
Posted: Wed May 10, 2006 12:14 pm Post subject: Re: Simpliest way to just grab a single picture from a video |
|
|
Thomas G. Liesner wrote:
| Quote: | Hello!
I'm programming with Delphi for many years, but mostly data-driven
applications. Now i need to capture a picture from any installed
video-source.
DSPack is now installed and the demo-app "PlayCap" is _nearly_ what i
need. In my case i need a 'silent' solution which means - no window with
the current camerastream visible, only capture the current picture on
command and retrieve it as data without any visual feedback.
If i set VideoWindow to invisible the camerastream i doesn't care and is
visible, if i comment out "VideoWindow.QueryInterface(IBaseFilter,
DestFilter);" a separate window with the videostream opens.
Can someone give me hints how the silent way goes?
And it's bit annoying that if i run it in the IDE i get a protection
error because of the running debugger.
TIA,
Thomas G. Liesner
|
Maybe try TSamplegrabber.getbitmap instead of TVideowindow.getbitmap
hth
KimB |
|
| Back to top |
|
 |
Thomas G. Liesner Guest
|
Posted: Wed May 10, 2006 2:14 pm Post subject: Re: Simpliest way to just grab a single picture from a video |
|
|
KimB schrieb:
| Quote: | Maybe try TSamplegrabber.getbitmap instead of TVideowindow.getbitmap
|
That's what i'm doing - but without playing the source the samplegrabber
grabs nothing and if i play it wants to render visually.
My current hack (for a solution it's not pretty enough):
procedure TVideoForm.FormCreate(Sender: TObject);
var
i: integer;
Device: TMenuItem;
begin
VideoWindow := TVideoWindow.Create(self);
VideoWindow.parent := TForm.Create(self);
VideoWindow.FilterGraph := FilterGraph;
SysDev:= TSysDevEnum.Create(CLSID_VideoInputDeviceCategory);
if SysDev.CountFilters > 0 then
...
end;
procedure TVideoForm.OnSelectDevice(sender: TObject);
var
CaptureGraph: ICaptureGraphBuilder2;
SourceFilter, SampleFilter, DestFilter: IBaseFilter;
begin
FilterGraph.ClearGraph;
FilterGraph.Active := false;
Filter.BaseFilter.Moniker := SysDev.GetMoniker(TMenuItem(Sender).tag);
FilterGraph.Active := true;
FilterGraph.QueryInterface(ICaptureGraphBuilder2, CaptureGraph);
Filter.QueryInterface(IBaseFilter, SourceFilter);
SampleGrabber.QueryInterface(IBaseFilter, SampleFilter);
VideoWindow.QueryInterface(IBaseFilter, DestFilter);
CaptureGraph.RenderStream(nil, nil, SourceFilter,
SampleFilter, DestFilter);
FilterGraph.Play;
CaptureGraph := nil;
SourceFilter := nil;
SampleFilter := nil;
DestFilter := nil;
end;
procedure TVideoForm.SnapShotClick(Sender: TObject);
Var pic: TPicture;
begin
pic := TPicture.create;
SampleGrabber.GetBitmap(pic.Bitmap);
pic.SaveToFile('test.bmp')
end;
So the videostream is rendered to an invisble form and for the grabbing
no visual component is needed anymore.
Not nice, but a working base for what i habe to implement.
Any hints what i can eleminate in the source without elemenating the
possibility to capture are welcome...
So long,
Thomas G. Liesner
--
---------------- Neue Hamster-stable 2.1.0.11 seit 28.03.2006 -----------------
Ich suche eine neue Vollzeitarbeitsstelle als Softwareentwickler (Schwerpunkt
Windows) entweder im weiteren Umkreis von Münster (Westfalen) oder in Heim-
arbeit. Details: http://www.tglsoft.de <mailto:jobsuche (AT) tglsoft (DOT) de> |
|
| Back to top |
|
 |
Warrick Wilson Guest
|
Posted: Wed May 10, 2006 4:15 pm Post subject: Re: Simpliest way to just grab a single picture from a video |
|
|
"Thomas G. Liesner" <tgl (AT) gmx (DOT) de> wrote in message
news:e3svcn.21g.1 (AT) news (DOT) tglsoft.de...
| Quote: | KimB schrieb:
Maybe try TSamplegrabber.getbitmap instead of TVideowindow.getbitmap
That's what i'm doing - but without playing the source the samplegrabber
grabs nothing and if i play it wants to render visually.
My current hack (for a solution it's not pretty enough):
|
I recall seeing something about this on the www.progdigy.com forums - that's
where the DSPack users hang out. Instead of a TVideoWindow, use a
NullRenderer. But check first in those forums for the correct answer, and
possibly some sample code. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|