IC Imaging Control ActiveX

Adjust Image Settings

Adjust Image Settings

This chapter shows you how to adjust image settings such as brightness, contrast, saturation, etc.

The source code for this sample program can be found in the samples\VB6\Adjusting Image Settings directory.

Setting up the Project

Create a new project and add IC Imaging Control to the form. Before you run the program, select the video device, input and video format as shown in the FirstSteps chapter. Alternatively, run the program without selecting a device. In this case, the program shows the device selection dialog provided by IC Imaging Control. If you close this dialog without making a selection, the program displays an error message and terminates.

Add a Label control and a Slider to the form. (You may need to add a Microsoft Windows Common Controls ActiveX to your project first to have the slider control appear in your Visual Basic toolbox). Set the Label control's "Caption" property to "Brightness".


Image settings, such as brightness, can be accessed using the VCDSimpleProperty class. This class is stored in the samples\vb6\common directory.

In the Visual Basic™ project property window, right click on the project and choose "Add" from the context menu. Now choose "Class Module". A new dialog opens. In the dialog click on the "Existing" tab and change to the samples\vb6\common directory.


Select the VCDSimpleProperty.cls file and click the "Open" button. Now, the VCDSimpleProperty class is added to the project and ready for use.

The identifiers, which are needed to specify a certain property when using the VCDSimpleProperty class, are declared in the module VCDPropertyID. The identifier for brightness is VCDID_Brightness. In order to use these identifiers, the module must be added to the project. Right click on the project in the Visual Basic™ project window and choose "Add" from the context menu. Now choose "Module" and a dialog opens. In the dialog, click on the "Existing" tab and change to the samples\vb6\common directory.


Select the VCDPropertyID.bas file and and click the "Open" button. Add the module VCDSimpleModule.bas in the same way to the project.

Writing the source code

First of all add a new variable to your form:

Private VCDProp As VCDSimpleProperty

You then need to initialize the VCDProp variable to get access to the properties of the video capture device.

Set VCDProp = GetSimplePropertyContainer(ICImagingControl1.VCDPropertyItems)

Then the slider is initialized, so that it has the correct value for minimum and maximum.

After initializing the range, the VCDProp.RangeValue(VCDID_Brightness) return value is used to initialize the thumb position of the slider. A call to the LiveStart method starts the live image display.

Private Sub Form_Load()

    ' If there was no video capture device selected in the Properties window
    ' show the device selection dialog of IC Imaging Control.
    If Not ICImagingControl1.DeviceValid Then

        If Not ICImagingControl1.DeviceValid Then
            MsgBox "No device was selected."
            Unload Me
            Exit Sub
        End If
    End If

    If ICImagingControl1.DeviceValid Then
        ' Initialize the VCDProp class to access the properties of our ICImagingControl
        ' object
        Set VCDProp = GetSimplePropertyContainer(ICImagingControl1.VCDPropertyItems)

        ' Setup the range of the brightness slider.
        Slider1.Min = VCDProp.RangeMin(VCDID_Brightness)
        Slider1.Max = VCDProp.RangeMax(VCDID_Brightness)
        ' Set the slider to the current brightness value.
        Slider1.Value = VCDProp.RangeValue(VCDID_Brightness)
    End If
End Sub

Finally, only a single line of code is required to adjust the brightness setting when the slider is moved:

Private Sub Slider1_Scroll()
    VCDProp.RangeValue(VCDID_Brightness) = Slider1.Value
End Sub

You are now ready to run the program, and move the slider's thumb with the mouse to adjust brightness. All image settings are handled in the same way, so once you know how to adjust brightness, you also know how to handle contrast, hue, zoom, and all the other settings.

<< Programmer's Guide

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