The DsPack component can be used to access multi web camera (Multi Web camera accessing). In this example, the camera accessing program is conducted toward 3 different brand of camera, in order that there is no conflict or mistake occur in the program reading so that the result of webcam visualization which is appeared is not appropriate with the expectation because of mistaken in choosing the camera variety because same name factor.
P.S.: because of limited camera, we just use 1 camera but basically Multi Webcam Access program (Multi Webcam Accessing) in Borland Delphi 7 using DsPack has been tested and has good result.
Enter the component as follows:
No | Component Name | Property | Value |
1 | GroupBox1 | Caption | Camera |
2 | GroupBox2 | Caption | Camera |
3 | GroupBox3 | Caption | Camera |
4 | ComboBox1 | Text | - |
5 | ComboBox2 | Text | - |
6 | ComboBox3 | Text | - |
7 | Filtergraph1 | Mode | gmCapture |
8 | Filtergraph2 | Mode | gmCapture |
9 | Filtergraph3 | Mode | gmCapture |
10 | Filter 1 | Filtergraph | Filtergraph1 |
11 | Filter 2 | Filtergraph | Filtergraph2 |
12 | Filter 3 | Filtergraph | Filtergraph3 |
13 | VideoWindow1 | Filtergraph | Filtergraph1 |
14 | VideoWindow2 | Filtergraph | Filtergraph2 |
15 | VideoWindow3 | Filtergraph | Filtergraph3 |
The image of the design program is as follows:
Picture1: Visualization program design Multi Webcam Accessing (Multi Webcam Accessing) in Borland Delphi 7 using DsPack
Next, please type the source code:
No | Component Name | Event | Source Code |
1 | Form1 | OnCreate | var i : integer; begin CapEnum:= TSysDevEnum.Create(CLSID_VideoInputDeviceCategory); for i := 0 to CapEnum.CountFilters - 1 do begin combobox1.Items.Add(CapEnum.Filters[i].FriendlyName); combobox2.Items.Add(CapEnum.Filters[i].FriendlyName); combobox3.Items.Add(CapEnum.Filters[i].FriendlyName); end; |
2 | Form1 | OnCloseQuery | capenum.Free; FilterGraph1.Stop; FilterGraph1.ClearGraph; FilterGraph1.Active := false; FilterGraph2.Stop; filtergraph2.ClearGraph; filtergraph2.Active:=false; FilterGraph3.Stop; filtergraph3.ClearGraph; filtergraph3.Active:=false; |
3 | ComboBox1 | OnChange | FilterGraph1.ClearGraph; FilterGraph1.Active := false; Filter1.BaseFilter.Moniker := CapEnum.GetMoniker(combobox1.ItemIndex); FilterGraph1.Active := true; with FilterGraph1 as ICaptureGraphBuilder2 do Renderstream(@PIN_CATEGORY_PREVIEW, nil, Filter1 as IBaseFilter,nil, VideoWindow1 as IbaseFilter); FilterGraph1.Play; |
4 | ComboBox2 | OnChange | FilterGraph2.ClearGraph; FilterGraph2.Active := false; Filter2.BaseFilter.Moniker := CapEnum.GetMoniker(combobox2.ItemIndex); FilterGraph2.Active := true; with FilterGraph2 as ICaptureGraphBuilder2 do Renderstream(@PIN_CATEGORY_PREVIEW, nil, Filter2 as IBaseFilter,nil, VideoWindow2 as IbaseFilter); FilterGraph2.Play; |
5 | ComboBox3 | OnChange | FilterGraph3.ClearGraph; FilterGraph3.Active := false; Filter3.BaseFilter.Moniker := CapEnum.GetMoniker(combobox3.ItemIndex); FilterGraph3.Active := true; with FilterGraph3 as ICaptureGraphBuilder2 do Renderstream(@PIN_CATEGORY_PREVIEW, nil, Filter3 as IBaseFilter,nil, VideoWindow3 as IbaseFilter); FilterGraph3.Play |
This Application is limited in webcam presenter,
next can be developed into picture capturer (photo/picture capturer), also video recorder (video capture)
Here is the result using 1 webcamera.
Here is the result using 3 webcamera.
The picture above, is created by Mr.Dayat Kurniawan ( http://hanundany.wordpress.com )
I hope this article can give benefit to the visitors, readers, developer and me. Thanks for visiting and availability for sharing this article by pressing
Share this on Facebook |