Contrast Enhancement - Part 3 This programming example shows how to setup the neutral parameters of a video capture device using IC Imaging Control and the CSimpleProperty class.
After the video capture device has been opened, create the SimpleProperty object: VB.NET ' Declare the Simple Property helper class object. Dim SimpleProperty As TIS.Imaging.VCDHelpers.VCDSimpleProperty ' Initialize the SimpleProperty class to access the properties of our ICImagingControl object. SimpleProperty = TIS.Imaging.VCDHelpers.VCDSimpleModule.GetSimplePropertyContainer(IcImagingControl1.VCDPropertyItems) C# // Declare the Simple Property helper class object. TIS.Imaging.VCDHelpers.VCDSimpleProperty SimpleProperty; // Initialize the SimpleProperty class to access the properties of our ICImagingControl object. SimpleProperty = TIS.Imaging.VCDHelpers.VCDSimpleModule.GetSimplePropertyContainer(icImagingControl1.VCDPropertyItems); Disable the appropriate property automatics like gain, white balance and brightness: VB.NET ' Disable the automatics. If SimpleProperty.AutoAvailable(TIS.Imaging.VCDIDs.VCDID_Gain) Then SimpleProperty.Automation(TIS.Imaging.VCDIDs.VCDID_Gain) = False End If If SimpleProperty.AutoAvailable(TIS.Imaging.VCDIDs.VCDID_WhiteBalance) Then SimpleProperty.Automation(TIS.Imaging.VCDIDs.VCDID_WhiteBalance) = False End If If SimpleProperty.AutoAvailable(TIS.Imaging.VCDIDs.VCDID_Brightness) Then SimpleProperty.Automation(TIS.Imaging.VCDIDs.VCDID_Brightness) = False End If If SimpleProperty.AutoAvailable(TIS.Imaging.VCDIDs.VCDID_Gamma) Then SimpleProperty.Automation(TIS.Imaging.VCDIDs.VCDID_Gamma) = False End If C# // Disable the automatics if( SimpleProperty.AutoAvailable(VCDIDs.VCDID_Gain)) SimpleProperty.Automation[VCDIDs.VCDID_Gain] = false; if( SimpleProperty.AutoAvailable(VCDIDs.VCDID_WhiteBalance)) SimpleProperty.Automation[VCDIDs.VCDID_WhiteBalance] = false; if( SimpleProperty.AutoAvailable(VCDIDs.VCDID_Brightness)) SimpleProperty.Automation[VCDIDs.VCDID_Brightness] = false; if( SimpleProperty.AutoAvailable(VCDIDs.VCDID_Gamma)) SimpleProperty.Automation[VCDIDs.VCDID_Gamma] = false; Now set the parameter values for gain, brightness, white balance blue and red : VB.NET SimpleProperty.RangeValue(TIS.Imaging.VCDIDs.VCDID_Gamma) = 10 SimpleProperty.RangeValue(TIS.Imaging.VCDIDs.VCDID_Brightness) = 0 ' Gain neutral is 180 for FireWire, 260 for USB cameras from The Imaging Source. SimpleProperty.RangeValue(TIS.Imaging.VCDIDs.VCDID_Gain) = 180 SimpleProperty.RangeValue(TIS.Imaging.VCDIDs.VCDElement_WhiteBalanceBlue) = 32 SimpleProperty.RangeValue(TIS.Imaging.VCDIDs.VCDElement_WhiteBalanceRed) = 32 SimpleProperty.RangeValue(TIS.Imaging.VCDIDs.VCDID_Hue) = 180 SimpleProperty.RangeValue(TIS.Imaging.VCDIDs.VCDID_Saturation) = 127 C# // Set the property values SimpleProperty.RangeValue[VCDIDs.VCDID_Brightness] = 0; // Gain neutral is 180 for FireWire and 260 for USB cameras of The Imaging Source. SimpleProperty.RangeValue[VCDIDs.VCDID_Gain] = 180; SimpleProperty.RangeValue[VCDIDs.VCDElement_WhiteBalanceBlue] = 32; SimpleProperty.RangeValue[VCDIDs.VCDElement_WhiteBalanceRed] = 32; SimpleProperty.RangeValue[VCDIDs.VCDID_Gamma] = 10; SimpleProperty.RangeValue[VCDIDs.VCDID_Hue] = 180; SimpleProperty.RangeValue[VCDIDs.VCDID_Saturation] = 127; The list of properties to be set can be enhanced as needed, e.g. hue, saturation and so on. The parameter values to be set depend on the used video capture device. |