IC Imaging Control C++

Frame Filter Class Wizard

Frame Filter Class Wizard

This chapter shows how to create a new frame filter class, using the frame filter class wizard.

Introduction

The frame filter class wizard creates the source code for a frame filter class. Optionally, a property dialog for this frame filter can be added. The image processing implemented by the filter inverts the incoming frames. This should be overwritten by the programmer.

The frame filter class wizard adds two member variables to the class:

m_bEnabled
This boolean value can be used in the transform method of the frame filter class to enable or disable image processing. This variable is exported by the frame filter class. Thus, the methods setEnabled and getEnabled are inserted into the frame filter class. In the constructor of the class, this variable is added to the property list of the frame filter:
addBoolParam( L"Enable", getEnabled, setEnabled);
m_lValue
This long value is only for educational purposes. It shows how to add and export a frame filter variable as a parameter. The code for the import and export methods and the insertion of the variable into the exported parameter list is created by the wizard.

If a property dialog is created by the frame filter class wizard (see below), then these two member variables can be modified in this dialog.

The Frame Filter Parameter Wizard can be used to add new property variables to a frame filter class.

How to use

The Frame Filter Class Wizard can be used in an application project only. Thus, an IC Imaging Control application should be created first. The Dialog Application Wizard can be used for this task.

In Visual Studio, open the Class View. In the Class View, right click on the applications name (the root entry on the top). In the context menu that is now displayed, select Add... -> Add class.... Now, the class wizard selection is shown:

image

Next, double click the IC Frame Filter Class icon. Now, the properties of the frame filter class are shown:

image

Input field description

Class name
This is the name of the class e.g. CMyFilter.
.h file
This is the name of the header file of the class. The name is generated by the class wizard. You may overwrite this name, if you wish.
.cpp file
This is the name of the cpp file of the class. The name is generated by the class wizard. You may overwrite this name, if you wish.
Filter name
This is the name of the filter that is used, if the filter is inserted into a filter list in an application. Click here for a sample of the resulting source code.
Transform filter / Update filter
These radio buttons determine, whether the newly created frame filter is a transform or an update filter. If the video format or color format of a frame is changed in the filter, then a transform filter is used. It creates a new frame in memory in to which the data of the source frame is copied.
The update filter performs the changes directly in the current frame.
Property dialog
If you check this check box, the wizard creates a property dialog for the frame filter class. You can use the property dialog to adjust the parameters of the class.
Notify at start and stop live video
If this check box is checked, then the frame filter class wizard inserts the methods that are called when startLive and stopLive are called. The methods are named notifyStart and notifyStop. You can also add a new boolean attribute 'm_bLiveVideoRunning' to the class. The methods look like follows:
//////////////////////////////////////////////////////////////////////////
// This method is called by the framework when the live video is started.
//////////////////////////////////////////////////////////////////////////
void CMyFilter::notifyStart( const FrameTypeInfo& in_type, const FrameTypeInfo& out_type )
{
    m_bLiveVideoRunning = true;
}
 
//////////////////////////////////////////////////////////////////////////
// This method is called by the framework when the live video is stopped.
//////////////////////////////////////////////////////////////////////////
void CMyFilter::notifyStop()
{
    m_bLiveVideoRunning = false;
}

Once you have completed all of the above steps, click the Finish button. Now, the wizard creates the class.

<< Project Wizards

Get in touch with us


About The Imaging Source

Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, frame grabbers and video converters for production automation, quality assurance, logistics, medicine, science and security.

Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.

Automated Imaging Association ISO 9001:2015 certified

Contact us