MontiVision Blog | Get the RSS feed: XML/RSS | |
Tuesday, 15. April 2008, 09:00 Uhr
Switching between Live Sources at Runtime
We have finished a new DirectShow Filter, which allows to switch between live sources while the graph is running. This was possible before when using a capture card with multiple inputs, in case it provides a DirectShow crossbar filter.
Switching between webcams or IP camera sources is not that simple. Therefore we developed MV Crossbar. MV Crossbar makes it possible to seamlessly switch between running live sources of similar video fromat.
The following DirectShow filter graph captures MJPEG video streams from four IP Cameras and allows to switch between them. The IP Cameras MJPEG streams are accessed through our MV IP Camera Source DirectShow Filter.
![[image]](../../../blogimages/Crossbar_DirectShow_Filter_Graph_small.jpg)
MV Crossbar is the key component in this setup. Of course it can be configured to standard COM interfaces, in this case through our new generic filter parameter interface, which allows to configure DirectShow filter properties through the properties name.
![[image]](../../../blogimages/Crossbar_DirectShow_Filter_Properties.jpg)
This example does two things. It displays the currently selected input video stream and it stores one frame to an AVI video file every second second. The MV Multi File Writer DirectShow Filter is used for the recording.
![[image]](../../../blogimages/Crossbar_DirectShow_Writer_Filter.jpg)
Friday, 28. September 2007, 11:23 Uhr
Setting the Resolution of a Video Capture Source in Code
The following VB.NET Pseudo-Code describes the way to set a certain video resolution when working with video capture hardware:
'The required Smart Control COM Interfaces
Dim Graph as MVSmartControl.IMVSCFilterGraph
Dim Format as MVSmartControl.IMVSCSetupVideoStream
Graph = YourSmartControl.GetOcx()
Format = YourSmartControl.GetOcx()
'Load the filter configuration
Graph.LoadConfig(„MyConfig.mvp“)
Dim lFormatIndex as Long
Dim lSizeIndex as Long
Dim lSizeCount as Long
Dim lWantedSizeIndex as Long
‘Get Current Video Format Index, Size Index and the number of
‘available Sizes for the current video format (e.g. RGB24)
‘Internally the Smart Control has a list of formats for every
‘video source looking like this example:
‘ RGB24 640 x 480 PAL
‘ RGB24 800 x 600 PAL
‘ …
‘ UYVY 720 x 576 PAL
‘ …
Format.GetCurrentVideoFormat(„VideoSource“, lFormatIndex, lSizeIndex)
Format.GetVideoSizeInfoCount(“VideoSource”, lSizeCount)
‘Now we are looking for the desired size, e.g. 1024x768
‘and remember the size index in case we find our resolution
For i = 0 to lSizeCount
Dim xRes as Long
Dim yRes as Long
Dim VideoStandard as Long
Format.GetVideoSizeInfo(“VideoSource”, lFormatindex, i, xRes, yRes, VideoStandard)
If xRes == 1024 and yRes == 768 then
lWantedSizeIndex = i
End If
Next
‘Set the new format
Format.SetVideoFormat(“VideoSource”, lFormatIndex, lWantedSizeIndex)
‘Start the graph
Graph.Start()
In the same way you can change the video format (RGB24, UYVY, YV12, etc) and the VideoStandard (PAL, NTSC, etc).
Monday, 03. April 2006, 12:00 Uhr
The Use of Filter Events for Synchronization and Graph Control
How do i know when a Video Frame was processed by a certain MontiVision MontiVision DirectShow Filter?
How do i know when MV Image Grabber finished writing a Captured Image to file.
When is the right time to ask MV Motion Detection whether it detected Motion in the current Video Frame?
Answer: Filters Events!
MontiVision DirectShow Filters fire Events in order to enable developers to synchronize the graph control. Please have a look at the Documentation to find out which Events a Filter supports.
Filter Events need to be enabled for a certain through the Smart Controls IMVSCFilterEvents COM interface. The following piece of C# Code enables Filter Events for MV Blob Counter after the configuration (MVP) was loaded by the Smart Control:
MVSmartControl.IMVSCFilterEvents FilterEvents;
int Cookie = 0;
try
{
FilterEvents = (MVSmartControl.IMVSCFilterEvents)axMVSmartControl.GetOcx();
Cookie = FilterEvents.Enable( "MV Blob Counter");
}
catch(Exception e)
{
// Handle Exception ...
}
The returned Cookie is used to identify the MV Blob Counter in the Filter Events Handler.
In order to add the event handler for the Smart Control in C#, open the form containing the appropriate Smart ActiveX Control and select 'Events' in the ActiveX Properties (Menu -> View -> Properties Window). Double click 'FilterEvent' to add an Event Handler:
![[image]](../../../blogimages/HandleFilterEvents.gif)
In the Event Handler, make sure to check the cookie to be sure the Event was called for the MV Blob Counter. In the following example the MV_ALGORITHM_END_EVENT is used to get the results of the blob detection performed by MV Blob Counter:
private void axMVSmartControl_FilterEvent(object sender, AxMVSmartControl._IMVSmartControlEvents_FilterEventEvent e)
{
if( e.cookie == Cookie ) // MV Blob Counter
{
switch(e.eventCode)
{
case MV_ALGORITHM_END_EVENT:
// Algorithm finished, get results from MV Blob Counter
GetBlobCounterResults();
break;
}
}
}
Please have a look at the MontiVision Smart Control Sample Applications for details in your preferred programming language.
Thursday, 23. March 2006, 10:00 Uhr
MV Filter SDK Wizard for Visual Studio 2005
A MontiVision Filter SDK Project Wizard for Visual Studio 2005 is available for download. The zipped package includes a text file (install.txt) describing the installation of the wizard.
Download Visual Studio 2005 Filter SDK Wizard
Thursday, 23. March 2006, 09:00 Uhr
Setup Borland Delphi 2005 For The MontiVision Development Kit
The MontiVision Development Kit provides library, module and package files for using MontiVision ActiveX Controls and DirectShow Filters within the Borland Delphi environment. The installation directory of the development kit contains a delphi folder. This article explains how these files can be used with Borland Delphi 2005.
Win32 Application Development
Open the package located in the delphi folder of the MV Development Kit installation directory. Select the 'Open Project...' command from the file menu:
![[image]](../../../blogimages/delphi2005_open_project_dialog.png)
Upgrade the project to 'Delphi for Win32':
![[image]](../../../blogimages/delphi2005_project_upgrade.png)
The project bar should contain the MVSDK project now:
![[image]](../../../blogimages/delphi2005_project_view.png)
Compile the package:
![[image]](../../../blogimages/delphi2005_compile.png)
Install the package:
![[image]](../../../blogimages/delphi2005_install.png)
The tool pallette does now contain the MontiVision ActiveX Controls:
![[image]](../../../blogimages/delphi2005_tool_pallette.png)
.NET Application Development
Select the 'Installed .NET Components' comand in the Component menu:
![[image]](../../../blogimages/delphi2005_net_install_components_menu.png)
Open the 'ActiveX Components' page, select the MontiVision ActiveX controls and confirm by pushing the 'OK' button:
![[image]](../../../blogimages/delphi2005_net_install_components.png)
The .NET tool palette does contain the MontiVision ActiveX Controls now:
![[image]](../../../blogimages/delphi2005_net_tool_pallette.png)
Monday, 06. February 2006, 11:39 Uhr
Video Ring Buffering or 'How to record video before the recording is started?'
There are applications which require to record live video that was captured before the actual recording starts.
A typical surveillance task is to record a few seconds of video from before to a few seconds after a certain event occured, e.g. a person crossed a photoelectric barrier.
This task can be solved by utilizing a video ring buffer as implemented in MV Block Recording.
![[image]](../../../blogimages/RingBuffer.gif)
One trigger signal on the I/O input pin of MV Block Recording starts the actual recording to file.
Monday, 06. February 2006, 10:22 Uhr
Select certain Media Type for a Filter Connection
Sometimes you want to make sure that a certain media type is used for a connection between two DirectShow filters, but filters negotiate their preferred media types without user interaction.
Recently a developer asked us for support as he tried to use our MV Network filters to transmit MV I/O pin data over a network, but the MV Integer I/O Source filter connected to the MV Network Renderer using the first best media type while he needed UINT16.
For situations like these, the MontiVision Developemnt Kit provides a filter called MV Select MediaType. it is used as follows: Insert the filter into the Workbench, open its Property Page dialog, enable the check box and leave the dialog open. Now connect the source filters output pin to the input pin of MV Select MediaType.
![[image]](../../../blogimages/SelectMediaType.gif)
A dialog will pop up for every media type the source filter offers and it's on to you to select the one you need.
![[image]](../../../blogimages/SelectMediaTypeDialog.gif)
Once the connection is done, you may close the dialog and go on connecting the output pin.
Friday, 27. January 2006, 16:27 Uhr
Noise Removal
There are different ways to reduce the noise in images or video. I'd like to mention the three most common ones.
If you video is noisy, maybe because you are using a low cost camera, and you'd like to smooth it to enhance your following processing results, you may choose linear gaussian filtering using MV Linear Filter. If the flexibility to implement custom filter matrices is required, MV Convolution is the right tool.
Another option would be using a median filter as implemented in MV Nonlinear Filter. A median filter will also be a great help if you need to eliminate so called salt and pepper noise, for example introduced by overdrive.
When using a streaming video source like a webcam for still image capture, you can achieve great noise reduction results by averaging a number of successive video frames using MV Smooth Sequence.
Thursday, 26. January 2006, 12:17 Uhr
Using video files as source with Smart Control
When you plan to use video files as source for your MontiVision configuration, you should create the MVP file with an uncompressed AVI file which acts as a dummy similiar to MV Demo Source in video capture configurations.
The source filter used for video files is 'File Source (Async.)', it can be found in the Stream \\ Source section. You also need to add the 'AVI Splitter' which can be found in the Stream \\ Transform \\ Splitter section. Before you save the configuration, make sure to right click the file source filter and give it a useful name like 'VideoFileSource'.
![[image]](../../../blogimages/VideoFileSource.gif)
After calling IMVSCFilterGraph::LoadConfig( XYZ.mvp ) or IMVSCFilterGraph2::LoadConfigFromString( szXYZ ) in your application, you have to handle the Smart Controls OnFilterCreated event. If the 'Label' parameter of the event says 'VideoFileSource', it is time to set the actual video source file.
Setting a video file on 'File Source (Async.)' is done using IMVSCSetFile::SetSourceFile("VideoFileSource", "C:\\Path\\File.avi"). The Smart Control will insert an appropriate decompressor after the source filter if that should be required.
Tuesday, 24. January 2006, 11:07 Uhr
Redistributing the MontiVision License
There are different ways to redistribute the license to your customers:
a) Copy the license file to a temporary folder on the target machine, Run 'RegEdit C:\Path\File.reg' and delete the license file from the target machine.
b) Copy the data out of the license file and tell your installer to add the information to the appropriate registry key.
c) Create the registry key within your application.
1 2 »
Admin-Login
|