With frame filters, a versatile and powerful way to manipulate image data is introduced. Besides other features, frame filters can be used to change or convert the video format of the image stream, implement image processing and control which frames are processed.
In contrast to other DirectShow libraries, the frame filters of IC Imaging Control are not DirectShow filters. But they are executed in the context of a DirectShow thread that processes the image stream. This saves the programmer the hassle of creating a DirectShow filter module, registering it and defining interfaces for the parameters. Frame filters are implemented by deriving from the class FrameFilterImpl or FrameUpdateFilterImpl. Easy access to the parameters of a frame filter is provided by the class IFrameFilter. On the one hand, frame filters may be implemented as part of a filter module. On the other hand, a frame filter can be created directly in an application, if its class is known.
Frame filters open the door to a vast number of new IC Imaging Control based applications. In order to show you what is possible with this new concept, we discuss categories of tasks that can be implemented with frames filters. For some of these tasks, frame filters are shipped with IC Imaging Control.
There are 2 basic types of frame filters which will be discussed in the following. Both types provide the same way of parameter access and allow frames to be dropped explicitly.
As described earlier, frame filters can be created directly in an application or loaded from a filter module. IC Imaging Control provides some filters in the module stdfilters.ftf. In order to obtain a list of the frame filters in all currently available filter modules, call the method FilterLoader::getAvailableFrameFilters. With the method FilterLoader::setLoadPath, an additional path for filter modules may be specified. A call to FilterLoader::createFilter creates an instance of a filter that was selected from the list of available filters. Now that we have a frame filter instance, we can insert it at three different locations in the image stream:
Please note that the same instance of a frame filter should not be used at more than one place in the image stream because its internal state may get inconsistent, especially if FrameFilterImpl::notifyStart and FrameFilterImpl::notifyStop are used. If it is necessary to insert the same filter at more than one location in the image stream, different instances of the frame filter should be used.
The internal data of a frame filter can be accessed through the parameter interface. With the method IFrameFilter::getParameter and IFrameFilter::setParameter, the following basic data types can be read from or written to the filter: bool, int, long float and std::string. A block of binary data can be exchanged with a frame filter by the methods IFrameFilter::getData and IFrameFilter::setData. Since the transform method of a filter is executed within a DirectShow thread, it is very important to synchronize external and internal access to the filter's data. Therefore, it is very important that a sequence of calls to the four methods mentioned above is preceded by a call to IFrameFilter::beginParamTransfer and is followed by a call to IFrameFilter::endParamTransfer:
pFrameFilter->beginParamTransfer(); // All calls to setParameter and getParameter here... pFrameFilter->endParamTransfer();
If a frame filter is used by generic applications, such as the Filter Inspector, a dialog should be implemented that allows the parameters to be altered interactively. A frame filter indicates that it provides a parameter dialog by returning true in the method IFrameFilter::hasDialog. The dialog should be displayed when the method IFrameFilter::callDialog is called.
Every frame filter should provide the serialization of its internal data by implementing the methods IFrameFilter::getSettings and IFrameFilter::setSettings. The representation of the data has to be string compatible.
Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, video converters and embedded vision components for factory automation, quality assurance, medicine, science, security and a variety of other markets.
Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE, MIPI interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.