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.
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.
First of all add a new variable to your form:
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.
Finally, only a single line of code is required to adjust the brightness setting when the slider is moved:
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.