Filter Inspector

This example demonstrates how to use frame filters to perform basic image processing.

It shows, how to:

The source code for this sample program can be found in the samples\VB6\Filter Inspector directory.

Using the Example

On the left side of the dialog box, there are two list boxes. The upper list box shows all filter modules that were found by IC Imaging Control. When you select one of the filter modules in this list, the lower list box displays the frame filters that can be loaded from the selected module.

When you click on one of the frame filters in the second list box, the filter is inserted in the Device Path. The live video displayed on the right side of the dialog box should now visualize the work of the frame filter.

You can click the Dialog... button to display the selected filter's property dialog.

If you select a new filter, the old filter will be removed and the new one will be used instead.

To see the untransformed image data from the video capture device, click the Remove button.

Initialization

In the Form_Load event, ICImagingControl is initialized. If no device has been selected, ShowDeviceSettingsDialog is used to display a device selection dialog box. An important part here is to disable graphic overlay completely by setting ICImagingControl.OverlayBitmapPosition to PATHPOSITION_NONE, thus avoiding interference with the possible color formats of the frame filters.

Enumerating Available Frame Filters

To obtain a list of available frame filters, use ICImagingControl.FrameFilterInfos, which returns a collection of FrameFilterInfo objects.

Now we want to fill a list box with the names of the files in which the filters have been found. To do that, we look at each filter and add its module name to the list box, while filling ModulePaths with the module paths of the filters. The module names are not added, if the module path is already in the collection:

In the event handler, which is called when the user selects a filter module name from the list box, a second list box is filled with the names of the filters in that module:

The loop fills a list box with all the frame filters that were loaded from the specified module. The index of the added filters in the original filter list (that was retrieved from ICImagingControl.FrameFilterInfos ) are stored in the list box's item data by setting ListBox.ItemData, thus allowing the filter info to be found when an end user clicks the item.

Creating Frame Filter Instances

When the user selects a filter from the filter list, the item data of the selected item is read, using ListBox.ItemData. Because we previously stored the filter's index in the list of available filters in the item data, we can use this number now to select the FrameFilterInfo in ICImagingControl.FrameFilterInfos:

The frame filter instance is created by calling ICImagingControl.FrameFilterCreate with the FrameFilterInfo object as its parameter.

Set the Frame Filter

To activate the frame filter, it has to be registered at the ICImagingControl object. The ICImagingControl.DeviceFrameFilters collection is cleared and the new filter is inserted. Device frame filters are used to transform the image data that comes from the video capture device.

Live mode has to be stopped in order to set a frame filter.

<< Programmer's Guide