« 

Binning and Video Formats in VB.NET

Posted by Stefan Geißler on April 14, 2011

Using binning is quite simple. The exact video format simply must be passed to the ic.VideoFormat property:

IcImagingControl1.VideoFormat = "RGB32 (640x480) [Binning 4x]" 

But often it is necessary to provide a list of available video formats. The DFK 72 series has many video formats, based on the ROI of the CMOS sensor. That means, it is possible to choose almost any resolution between the minimum (96x96) and the maximum format (2592x1944). Therefore, it is not a good idea, to implement a list of all possible video formats, because it is just too long.

Therefore, we invented the video format description VideoFormatDesc in IC Imaging Control 3.2. The VideoFormatDesc shows the pixel format, the minimum and maximum resolution and some more properties, e.g. binning. Thus, it is a better idea to define a list with formats presented to the user, like 320x240, 640x480, 1920x1080 and so on. This can be done in an array:

Dim Sizes(6) As System.Drawing.Size

' Define some wanted video formats
Sizes(0) = New System.Drawing.Size(320, 240)
Sizes(1) = New System.Drawing.Size(640, 480)
Sizes(2) = New System.Drawing.Size(1024, 768)
Sizes(3) = New System.Drawing.Size(1600, 1200)
Sizes(4) = New System.Drawing.Size(1920, 1080) ' Full HD
Sizes(5) = New System.Drawing.Size(2592, 1944)

The camera has a list of VideoFormatDescriptions, which are saved in the VideoFormatDescs collection. We simply need to enumerate all video format descriptions and check, whether our required resolutions are valid for them. If so, we create a temporary video format and write its name, for example, into a combo box for selection by the end user:

cboVideoFormats.Items.Clear()
Dim S As Integer

For Each VFD As TIS.Imaging.VideoFormatDesc In IcImagingControl1.VideoFormatDescs
    For S = 0 To Sizes.Length() - 1
        If VFD.IsValidSize(Sizes(S)) = True Then ' Check, whether the current resolution fits 
            Dim VF As TIS.Imaging.VideoFormat
            VF = VFD.CreateVideoFormat(Sizes(S))
            'Console.WriteLine(VF.Name) ' For debugging purposes.
            cboVideoFormats.Items.Add(VF.Name)
        End If
    Next
Next

In the SelectedIndexChanged event handler of the combobox we can set the chosen video format:

Private Sub cboVideoFormats_SelectedIndexChanged(...)
    IcImagingControl1.LiveStop()
    IcImagingControl1.VideoFormat = cboVideoFormats.SelectedItem.ToString()
    IcImagingControl1.LiveStart()
End Sub

The parameter of the cboVideoFormats_SelectedIndexChanged sub have been removed to make the sample more readable.

Tagged with ActiveXVB6Delphi3.2.

This site is part of The Imaging Source Network. Other sites include Company Portal, Image Processing, Astronomy Cameras, Astronomy Cameras Blog, Blog caméras d'astronomie, Astronomy Cameras Competition, TX Text Control, LiveDocx, phpLiveDocx and Forums.