IC Imaging Control ActiveX User's Guide

Introduction

This chapter discusses the following topics: Manual organization, System requirements, Distributing

What's New

This part discusses the new features introduced in the latest IC Imaging Control releases.

Programmer's Guide

Perform your first steps with IC Imaging Control.

Technical Articles

Complete list of all technical articles.

Reference

Complete list of all classes and functions.

IC Imaging Control Standard Filters

IC Imaging Control comes with several standard frame filters. They can be explored with the Filter Inspector application.


Introduction

This chapter discusses the following topics: Manual organization, System requirements, Distributing

Welcome to IC Imaging Control, the image acquisition toolkit for Visual Basic, Visual C++ and .NET. With IC Imaging Control your application immediately supports Firewire cameras from Sony, The Imaging Source and other Vendors, USB cameras, DV cameras, PCI Frame grabbers andvideo-to-Firewire converters.

System Requirements

How this Manual is Organized

Distributing your Applications

<< IC Imaging Control ActiveX User's Guide


System Requirements

The Imaging Control ActiveX control requires the following minimum configuration

  • Windows™ 2000 with service pack 4 or Windows™ XP™.
  • DirectX™ 9.0c or higher.
  • Microsoft™ Visual Basic™ 6.
  • One or more WDM compliant video devices.

<< Introduction


How this Manual is Organized

  • Part 1, Introduction covers the topics: Manual Organization, System Requirements and Distributing Applications developed using IC Imaging Control
  • Part 2, What's New discusses the new features introduced in the last IC Imaging Control releases.
  • Part 3, Visual Basic™ Programmer's Guide, describes how to use IC Imaging Control with Microsoft™ Visual Basic™ 6. or .NET.
  • Part 4, Technical Articles, describes general concepts as well as some special features of IC Imaging Control in detail.
  • Part 5, Reference, contains a list of Imaging Control's classes, properties, methods and events sorted in alphabetical order.
  • Part 6, IC Imaging Control Standard Filters, describes the frame filters that are delivered with IC Imaging Control.

<< Introduction


Distributing your Applications

Using Package and Deployment Wizard

If you create a setup program for your Visual Basic application with the Package and Deployment Wizard that is part of Visual Basic 6, all redistributable files will be included automatically, and you can skip the remainder of this chapter.

Setup Toolkit

If you wish to use a different setup toolkit, the lists below show all the files necessary for IC Imaging Control to operate properly. You must ensure that the files exist on your client's machine and they are the correct version. If your client's machine has older versions of these files, you should update them.

Required Files

ActiveX Component:

  • ICImagingControl.OCX *) **)

Target directory: (Common Files)\IC Imaging Control 3\

Runtime DLLs:

  • TIS_DShowLib07_vc71.dll **)
  • TIS_UDSHL07_vc71.dll **)
  • ICFilterContainer.dll **)

Target directory: (Common Files)\IC Imaging Control 3\

Device Adapters:

  • dvdevice.vda **)
  • tisdcam.vda **)
  • vcc_vp.vda **)

Target directory: (Common Files)\IC Imaging Control 3\

Codec Adapters:

  • mjpeg.tca **)

Target directory: (Common Files)\IC Imaging Control 3\

Standard Frame Filters:

  • stdfilters.ftf **)

Target directory: (Common Files)\IC Imaging Control 3\

DirectShow Filters:

  • IAT_YUV.ax *) **)
  • DeBayerTransform.dll *) **)

Target directory: Windows\System32

System:

  • Msvcp60.dll **)
  • Mfc71.dll **)
  • Msvcp71.dll **)
  • Msvcr71.dll **)

Target directory: Windows\System32

Remarks

All files marked with *) must be registered using regsvr32.exe. It is very important to copy all files to the target computer, before registering these files. Most setup toolkits have an option to automate this task.

For all files marked with **), you have increase their reference counts in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\SharedDLLs. Most setup toolkits have options to perform this step automatically.

<< Introduction


What's New

This part discusses the new features introduced in the latest IC Imaging Control releases.

What's New in Version 3.0 since Version 2.0

Description of the changes from IC Imaging Control 2.0 to IC Imaging Control 3.0.

What is new in Version 2.0

Description of the changes from IC Imaging Control 1.41 to IC Imaging Control 2.0.

<< IC Imaging Control ActiveX User's Guide


What's New in Version 3.0 since Version 2.0

Description of the changes from IC Imaging Control 2.0 to IC Imaging Control 3.0.

Frame Filter

With frame filters, a versatile and powerful way to manipulate image data has been introduced. Frame filters can be used to do:

  • control which frames will be removed (dropped) from the image stream
  • read and write image data to/from frames of the image stream without having to copy the image data to a ring buffer. In other words: the frame filter allows image processing directly on buffers of the image stream (DirectShow buffers).
  • to change the video format (pixel format and/or width and height) of the image stream
  • implement image processing

Frame filters can be applied to the video stream at 3 locations: directly behind the video capture device, in front of the display and in front of the sink. This concept allows various functions to be implemented, such as a gate filter that passes only specific frames to a media file and drops the other ones. Frame filters can be implemented as part of an application or may reside in a filter container module. IC Imaging Control 3.0 comes with a few often used frame filters that can be loaded from the filter container module stdfilters.ftf:

  • ROI filter: changes the width and height of the image stream
  • DeBayer filter: transforms color raw data in Bayer format into an RGB color format.
  • Flip and rotation filter: Allows the image stream to be rotated (90°, 180° and 270°) and flipped (vertically and horizontally)
  • Denoise Filter: sums up a specified number of frames and divides the result by the number.

For details on the filters that come with IC Imaging Control, please refer to the chapter: IC Imaging Control Standard Filters.

Please note that frame filters cannot be implemented in Visual Basic. They have to be implemented in Visual C++ as part of a filter module.

New Sink Concept

IC Imaging Control 3.0 introduces a new sink concept. For an overview of sinks and image streams, please refer to Concepts and Components. Up to this version, sinks were used and managed internally to provide the functionality of accessing image buffers, using FrameReady Events and writing AVI files. There are two new sink objects:

  • FrameHandlerSink: This sink provides asynchronous grabbing of a specific number of images to the ring buffer and allows frame filters to be used in order to manipulate image data and control the copy process to the ring buffer collection. Using a frame filter, it is possible to create a ring buffer with a user defined pixel organization or omit the ring buffer collection totally by doing image processing directly on the buffers of the image stream (DirectShow buffers)
  • MediaStreamSink: This sink allows other stream containers than AVI to be used. For a description of the currently supported stream containers, please refer to MediaStreamContainer. In addition, the MediaStreamSink allows frame filters to be used in order to manipulate image data and control which frames are written to the stream file. This allows, for example, real time lapse functionality to be implemented.

Advanced Overlay Concept

Instead of having one overlay in the image stream just behind the device, IC Imaging Control 3.0 now allows up to 3 overlay objects to be used. The 3 possible locations are:

  • Behind the device: this overlay will appear in the display as well as in the sink (ring buffer, stream file).
  • In front of the display: this overlay will appear in the display only.
  • In front of the sink: this overlay will appear in the sink (ring buffer, stream file) only.

This new concept, for example, allows you to have an overlay on the display, while doing image processing on the original image data or having different overlays on the display and on the sink (ring buffer and stream file).

Support for Raw Color Data in Bayer Format

Using IC Imaging Conrol 3.0, it is possible to apply color interpolation to raw image data in Bayer format. The color interpolation is called debayering and may be applied to the display, as well as to the data that goes to the sink (ring buffer and stream file). For details, please refer to the chapter Debayering.

Support for 16 bit Monochrome Formats

IC Imaging Control 3.0 now supports high resolution monochrome and raw color (Bayer) formats with a pixel depth of up to 16 bit. A suitable display mode for all these formats is provided.

New Features Reference

List of all new features

<< What's New


New Features Reference

List of all new features

Extended Classes

List of all classes that have been extended in IC Imaging Control 3.0

New Classes

List of all classes that have been introduced in IC Imaging Control 3.0

New Enumerations

List of all enumerations that have been introduced in IC Imaging Control 3.0

<< What's New in Version 3.0 since Version 2.0


Extended Classes

List of all classes that have been extended in IC Imaging Control 3.0

New Methods of ICImagingControl

List of properties and methods that have been added to the ICImagingControl class in IC Imaging Control 3.0

New Methods of ImageBuffer

List of properties and methods that have been added to the ImageBuffer class in IC Imaging Control 3.0

New Methods of ImageBuffers

List of properties and methods that have been added to the ImageBuffers class in IC Imaging Control 3.0

New Methods of OverlayBitmap

List of properties and methods that have been added to the OverlayBitmap class in IC Imaging Control 3.0

<< New Features Reference


New Methods of ICImagingControl

List of properties and methods that have been added to the ICImagingControl class in IC Imaging Control 3.0

ICImagingControl.Sink

Sets or retrieves the currently used sink. A sink is an object that receives the frames coming from the video capture device and either copies them to an ImageBuffers collection or saves them to a media stream file.

ICImagingControl.FrameFilterPath

Sets a path from which frame filters are loaded.

ICImagingControl.FrameFilterInfos

This property returns a list, containing FrameFilterInfo objects that describe the available frame filters, which can be loaded from frame filter modules (.ftf files).

ICImagingControl.FrameFilterCreate

Creates a new instance of a FrameFilter from a FrameFilterInfo.

ICImagingControl.FrameFilterCreateString

Creates a new instance of a FrameFilter, by specifying the filter's name.

ICImagingControl.DeviceFrameFilters

The DeviceFrameFilters property provides a FrameFilters collection that contains the frame filters that are inserted in the device path.

ICImagingControl.LiveDisplayOutputWidth

Returns the actual width of the video format of the live display. Due to the use of frame filters, this width can differ from the width of the video capture device's video format and the sink's format.

ICImagingControl.LiveDisplayOutputHeight

Returns the actual height of the video format of the live display. Due to the use of frame filters, this height can differ from the height of the video capture device's video format and the sink's format.

ICImagingControl.ImageActiveBuffer

Returns the ImageBuffer to which the control copied the last frame.

ICImagingControl.DeBayerActive

Returns whether automatic de-bayering of BY8 image data is enabled.

ICImagingControl.DeBayerStartPattern

This property controls how the automatic de-bayering of BY8 image data should treat the pixel data.

ICImagingControl.DeBayerMode

This property selects the algorithm used to de-bayer BY8 image data.

ICImagingControl.OverlayBitmapPosition

This property controls the positions of OverlayBitmap objects in the image stream.

ICImagingControl.DisplayFrameFilters

The DisplayFrameFilters property provides a FrameFilters collection that contains the frame filters that are inserted in the display path.

ICImagingControl.OverlayBitmapAtPath

Returns the OverlayBitmap at a specified path position.

ICImagingControl.LiveShowLastBuffer

This property controls whether IC Imaging Control displays the buffer that was captured on LiveStop when LiveCaptureLastImage is enabled.

<< Extended Classes


ICImagingControl::Sink

ICImagingControl.Sink Property
Sets or retrieves the currently used sink. A sink is an object that receives the frames coming from the video capture device and either copies them to an ImageBuffers collection or saves them to a media stream file.
Syntax:
Public Sink As BaseSink
Limitations:

Run time only. Read only in live mode.

Remarks:

Available sink implementations are FrameHandlerSink and MediaStreamSink
Information:

Introduced in IC Imaging Control 3.0
See also: ICImagingControl, BaseSink, MediaStreamSink, FrameHandlerSink

<< ICImagingControl


ICImagingControl::FrameFilterPath

ICImagingControl.FrameFilterPath Property
Sets a path from which frame filters are loaded.
Syntax:
Public FrameFilterPath As String
Limitations:

Write only.

Remarks:

By default, frame filters are loaded from the directory of ICImagingControl.ocx. This property can be used to set more than one path.

Information:

Introduced in IC Imaging Control 3.0
Example:

The following code fragment sets a frame filter path and displays a list of all frame filters that can be loaded:

ICImagingControl1.FrameFilterPath = "..\filters\"

Dim info As FrameFilterInfo

For Each info In ICImagingControl1.FrameFilterInfos
    Debug.Print "Found Filter: " & info.Name & " in " & info.ModulePath & "."
Next
See also: ICImagingControl, ICImagingControl.FrameFilterInfos

<< ICImagingControl


ICImagingControl::FrameFilterInfos

ICImagingControl.FrameFilterInfos Property
This property returns a list, containing FrameFilterInfo objects that describe the available frame filters, which can be loaded from frame filter modules (.ftf files).
Syntax:
Public FrameFilterInfos As FrameFilterInfos
Limitations:

Ready only, run time only.

Information:

Introduced in IC Imaging Control 3.0
Example:

The following code fragment displays a list of all frame filters that can be loaded:

Dim info As FrameFilterInfo

For Each info In ICImagingControl1.FrameFilterInfos
    Debug.Print "Found Filter: " & info.Name & " in " & info.ModulePath & "."
Next
See also: ICImagingControl, ICImagingControl.FrameFilterPath, FrameFilterInfos, FrameFilterInfo

<< ICImagingControl


ICImagingControl::FrameFilterCreate

ICImagingControl.FrameFilterCreate Method
Creates a new instance of a FrameFilter from a FrameFilterInfo.
Syntax:
Public Function FrameFilterCreate( Info As FrameFilterInfo ) As FrameFilter

Name | Description
Info | The FrameFilterInfo object describing the frame filter to be created.
Information:

Introduced in IC Imaging Control 3.0
Example:

The following example shows how to create a FrameFilter instance from a FrameFilterInfo object:

' Retrieve the first FrameFilterInfo object.
Dim info As FrameFilterInfo
Set info = ICImagingControl1.FrameFilterInfos(1)

' Create the frame filter to which the info object refers.
Dim filter As FrameFilter
Set filter = ICImagingControl1.FrameFilterCreate(info)

' Set the frame filter as the device frame filter.
ICImagingControl1.DeviceFrameFilters.Add filter

' Start live mode.
ICImagingControl1.LiveStart

The frame filter is set as a device frame filter.

See also: ICImagingControl, ICImagingControl.FrameFilterCreateString, ICImagingControl.FrameFilterInfos, FrameFilter, FrameFilterInfos, FrameFilterInfo

<< ICImagingControl


ICImagingControl::FrameFilterCreateString

ICImagingControl.FrameFilterCreateString Method
Creates a new instance of a FrameFilter, by specifying the filter's name.
Syntax:
Public Function FrameFilterCreateString( FilterName As String, ModuleName As String ) As FrameFilter

Name | Description
FilterName | Name of the frame filter to be created.
ModuleName | Filter module from which the frame filter is loaded. Can be omitted.
Information:

Introduced in IC Imaging Control 3.0
Example:

The following code fragment shows how to create the DeBayer Filter from stdfilters.ftf:

Dim filter As FrameFilter
Set filter = ICImagingControl1.FrameFilterCreateString("DeBayer", "stdfilters.ftf")
See also: ICImagingControl, ICImagingControl.FrameFilterCreate, ICImagingControl.FrameFilterInfos, FrameFilter, FrameFilterInfos, FrameFilterInfo

<< ICImagingControl


ICImagingControl::DeviceFrameFilters

ICImagingControl.DeviceFrameFilters Property
The DeviceFrameFilters property provides a FrameFilters collection that contains the frame filters that are inserted in the device path.
Syntax:
Public DeviceFrameFilters As FrameFilters
Limitations:

Ready only, run time only.

Information:

Introduced in IC Imaging Control 3.0
See also: ICImagingControl, ICImagingControl.DisplayFrameFilters, FrameFilter

<< ICImagingControl


ICImagingControl::LiveDisplayOutputWidth

ICImagingControl.LiveDisplayOutputWidth Property
Returns the actual width of the video format of the live display. Due to the use of frame filters, this width can differ from the width of the video capture device's video format and the sink's format.
Syntax:
Public LiveDisplayOutputWidth As Long
Limitations:

Ready only, run time only.

Remarks:

This property only returns valid values when either live mode has been started, or SinkCompatibilityMode is True.

Information:

Introduced in IC Imaging Control 3.0
See also: ICImagingControl, ICImagingControl.LiveDisplayOutputHeight

<< ICImagingControl


ICImagingControl::LiveDisplayOutputHeight

ICImagingControl.LiveDisplayOutputHeight Property
Returns the actual height of the video format of the live display. Due to the use of frame filters, this height can differ from the height of the video capture device's video format and the sink's format.
Syntax:
Public LiveDisplayOutputHeight As Long
Limitations:

Ready only, run time only.

Remarks:

This property only returns valid values when either live mode has been started, or SinkCompatibilityMode is True.

Information:

Introduced in IC Imaging Control 3.0
See also: ICImagingControl, ICImagingControl.LiveDisplayOutputWidth

<< ICImagingControl


ICImagingControl::ImageActiveBuffer

ICImagingControl.ImageActiveBuffer Property
Returns the ImageBuffer to which the control copied the last frame.
Syntax:
Public ImageActiveBuffer As ImageBuffer
Limitations:

Read only, Run time only.
Information:

Introduced in IC Imaging Control 3.0
See also: ICImagingControl, ICImagingControl.ImageBuffers, ImageBuffer

<< ICImagingControl


ICImagingControl::DeBayerActive

ICImagingControl.DeBayerActive Property
Returns whether automatic de-bayering of BY8 image data is enabled.
Syntax:
Public DeBayerActive As Boolean
Limitations:

Ready only, run time only.

Remarks:

When this property returns True, ICImagingControl.DeBayerStartPattern and ICImagingControl.DeBayerMode can be used to configure the de-bayering algorithm.

Information:

Introduced in IC Imaging Control 3.0
See also: ICImagingControl, Debayering

<< ICImagingControl


ICImagingControl::DeBayerStartPattern

ICImagingControl.DeBayerStartPattern Property
This property controls how the automatic de-bayering of BY8 image data should treat the pixel data.
Syntax:
Public DeBayerStartPattern As DeBayerStartPatterns
Remarks:

You have to select the value that matches the layout of the camera's mosaic filter in front of the CCD. In general, this has to be found out by trial and error, because this information may be hard to find in the camera's documentation.

Information:

Introduced in IC Imaging Control 3.0
Example:

The following code fragment shows how to open a bayer camera, set the bayer video format BY8 and set the parameters for automatic de-bayering:

ICImagingControl1.Device = "DBK 31BF03"
ICImagingControl1.VideoFormat = "BY8 (1024x768)"
ICImagingControl1.DeBayerStartPattern = DEBAYERPATTERN_GB
ICImagingControl1.DeBayerMode = DEBAYER_EDGESENSING

ICImagingControl1.LiveStart
See also: ICImagingControl, DeBayerStartPatterns, DeBayerModes, Debayering

<< ICImagingControl


ICImagingControl::DeBayerMode

ICImagingControl.DeBayerMode Property
This property selects the algorithm used to de-bayer BY8 image data.
Syntax:
Public DeBayerMode As DeBayerModes
Information:

Introduced in IC Imaging Control 3.0
Example:

See DeBayerStartPattern for an example how of to configure the automatic de-bayering.

See also: ICImagingControl, DeBayerModes, Debayering

<< ICImagingControl


ICImagingControl::OverlayBitmapPosition

ICImagingControl.OverlayBitmapPosition Property
This property controls the positions of OverlayBitmap objects in the image stream.
Syntax:
Public OverlayBitmapPosition As PathPositions
Information:

Introduced in IC Imaging Control 3.0
See also: ICImagingControl, PathPositions

<< ICImagingControl


ICImagingControl::DisplayFrameFilters

ICImagingControl.DisplayFrameFilters Property
The DisplayFrameFilters property provides a FrameFilters collection that contains the frame filters that are inserted in the display path.
Syntax:
Public DisplayFrameFilters As FrameFilters
Limitations:

Ready only, run time only.

Information:

Introduced in IC Imaging Control 3.0
See also: ICImagingControl, ICImagingControl.DeviceFrameFilters, FrameFilter

<< ICImagingControl


ICImagingControl::OverlayBitmapAtPath

ICImagingControl.OverlayBitmapAtPath Property
Returns the OverlayBitmap at a specified path position.
Syntax:
Public OverlayBitmapAtPath( OverlayToFetch As PathPosition ) As OverlayBitmap
Limitations:

Ready only, run time only.

Information:

Introduced in IC Imaging Control 3.0
See also: ICImagingControl, OverlayBitmap, PathPositions

<< ICImagingControl


ICImagingControl::LiveShowLastBuffer

ICImagingControl.LiveShowLastBuffer Property
This property controls whether IC Imaging Control displays the buffer that was captured on LiveStop when LiveCaptureLastImage is enabled.
Syntax:
Public LiveShowLastBuffer As Boolean
Information:

Introduced in IC Imaging Control 3.0
See also: ICImagingControl

<< ICImagingControl


New Methods of ImageBuffer

List of properties and methods that have been added to the ImageBuffer class in IC Imaging Control 3.0

ImageBuffer.FrameType

Returns a FrameType object describing the image format of this ImageBuffer.

<< Extended Classes


ImageBuffer::FrameType

ImageBuffer.FrameType Property
Returns a FrameType object describing the image format of this ImageBuffer.
Syntax:
Public FrameType As FrameType
Information:

Introduced in IC Imaging Control 3.0
See also: ImageBuffer, FrameType

<< ImageBuffer


New Methods of ImageBuffers

List of properties and methods that have been added to the ImageBuffers class in IC Imaging Control 3.0

ImageBuffers.Active

Returns the ImageBuffer to which the control copied the last frame.

<< Extended Classes


ImageBuffers::Active

ImageBuffers.Active Property
Returns the ImageBuffer to which the control copied the last frame.
Syntax:
Public Active As ImageBuffer
Limitations:

Read only.
Information:

Introduced in IC Imaging Control 3.0
See also: ImageBuffers, ImageBuffers.CurrentIndex, ImageBuffer

<< FrameHandlerSink.ImageBuffers


New Methods of OverlayBitmap

List of properties and methods that have been added to the OverlayBitmap class in IC Imaging Control 3.0

OverlayBitmap.PathPosition

Returns the path position of this OverlayBitmap.

OverlayBitmap.ColorMode

Set the color mode of this OverlayBitmap. The color mode determines whether the overlay bitmap is painted in color or in grayscale. The images provided by the video capture device are converted into the selected format before drawing the overlay.

OverlayBitmap.OverlayFrameType

This property returns the actual image format of the overlay bitmap.

<< Extended Classes


OverlayBitmap::PathPosition

OverlayBitmap.PathPosition Property
Returns the path position of this OverlayBitmap.
Syntax:
Public PathPosition As PathPositions
Information:

Introduced in IC Imaging Control 3.0
See also: OverlayBitmap, PathPositions

<< ICImagingControl.OverlayBitmap


OverlayBitmap::ColorMode

OverlayBitmap.ColorMode Property
Set the color mode of this OverlayBitmap. The color mode determines whether the overlay bitmap is painted in color or in grayscale. The images provided by the video capture device are converted into the selected format before drawing the overlay.
Syntax:
Public ColorMode As OverlayColorModes
Information:

Introduced in IC Imaging Control 3.0
Example:

The following code fragment shows how to draw colored overlay graphics on grayscale live video:

' Set a grayscale video format.
ICImagingControl1.VideoFormat = "Y800 (1024x768)"

' Enable the overlay bitmap.
ICImagingControl1.OverlayBitmap.Enable = True

' Force the overlay bitmap to be in color mode.
ICImagingControl1.OverlayBitmap.ColorMode = OVERLAY_COLORMODE_COLOR

' Start live video.
ICImagingControl1.LiveStart

' Draw a red line.
ICImagingControl1.OverlayBitmap.DrawLine RGB(255, 0, 0), 0, 0, 100, 100
See also: OverlayBitmap, OverlayColorModes

<< ICImagingControl.OverlayBitmap


OverlayBitmap::OverlayFrameType

OverlayBitmap.OverlayFrameType Property
This property returns the actual image format of the overlay bitmap.
Syntax:
Public OverlayFrameType As FrameType
Limitations:

Read only.

Information:

Introduced in IC Imaging Control 3.0
See also: OverlayBitmap, FrameType

<< ICImagingControl.OverlayBitmap


New Classes

List of all classes that have been introduced in IC Imaging Control 3.0

BaseSink

This class represents a generic sink and provides properties and methods that all sinks have in common. A BaseSink can hold either a FrameHandlerSink or a MediaStreamSink. A FrameHandlerSink is used to access individual frames out of the image stream, while MediaStreamSink writes the image stream to a media file.

FrameFilter

FrameFilter is the class provides the interface to a filter that was loaded from a filter module. It contains methods to access the filter's parameters, display a configuration dialog and save filter settings.

FrameFilterInfo

A FrameFilterInfo object contains information about a frame filter that can be loaded from a frame filter module and instantiated, using ICImagingControl.FrameFilterCreate.

FrameFilterInfos

The FrameFilterInfos class contains FrameFilterInfo objectsm describing frame filters that can be loaded from an existing module.

FrameFilters

The FrameFilters class represents a chain of FrameFilter objects, that are used to transform the image data along the Device Path, Sink Path and Display Path.

FrameHandlerSink

The FrameHandlerSink is the SinkType used to grab (copy) frames from the image stream. It contains an ImageBuffer collection and optionally allows you to specify one or more FrameFilters that are responsible for copying the image data to the ImageBuffers. The FrameFilter implementation can perform user-defined transformations while copying the data, and they can intentionally drop unwanted frames. If no frame filter is registered, the frames are copied to the ImageBuffer collection without being changed.

FrameType

A FrameType describes the color format and (optionally) dimensions and buffer size of the image format of ImageBuffer objects.

FrameTypes

The FrameTypes collection is used to define a list of FrameTypes. A FrameTypes collection is used, i.e. to determine which FrameTypes are accepted by a frame filter or a sink.

MediaStreamContainer

A MediaStreamContainer describes a video file format. The most common video file format is AVI.

MediaStreamContainers

MediaStreamContainers is a collection of MediaStreamContainer objects. The collection contains all available media stream containers. The ICImagingControl.MediaStreamContainers property returns a MediaStreamContainers collection.

MediaStreamSink

The MediaStreamSink allows video files to be recorded in a more sophisticated manor than is possible using AviStartCapture and AviStopCapture. However, for simple tasks, the methods AviStartCapture and AviStopCapture are better suited, as they are really easy to use. A MediaStreamSink can save image data to video files in various formats and optionally allows you to specify one or more FrameFilters that can analyze and/or transform the image data, before it is written to the video file.

<< New Features Reference


BaseSink

This class represents a generic sink and provides properties and methods that all sinks have in common. A BaseSink can hold either a FrameHandlerSink or a MediaStreamSink. A FrameHandlerSink is used to access individual frames out of the image stream, while MediaStreamSink writes the image stream to a media file.

Example

The following example illustrates how to use the BaseSink type, when handling a sink object whose actual type is unknown:

Private Sub captureImageSequence(IC As ICImagingControl)

    ' Save the currently set sink object, using a BaseSink reference.
    Dim oldSink As BaseSink
    Set oldSink = IC.Sink

    ' Create a new sink object.
    Dim fhs As New FrameHandlerSink

    ' Initialize the new sink.
    fhs.BufferCount = 10

    ' Set the new sink.
    IC.Sink = fhs

    ' Use the new sink.
    IC.LiveStart
    fhs.SnapImageSequence 10, -1
    ' ...
    IC.LiveStop

    ' Restore the old sink.
    IC.Sink = oldSink

End Sub

Information

Introduced in IC Imaging Control 3.0

Inheritance

BaseSink
FrameHandlerSink
MediaStreamSink

Properties

Property | Description
SinkModeRunning | Gets or sets the "running" state of the sink.

Methods

Method | Description
SinkType | This property returns a member of the BaseSinkTypes enumeration that describes the type of this sink object.

<< Classes


BaseSink::SinkModeRunning

BaseSink.SinkModeRunning Property
Gets or sets the "running" state of the sink.
Syntax:
Public SinkModeRunning As Boolean
Remarks:

This method is used to pause and restart an image stream for video capturing and frame grabbing. After the running mode is set to False, frame grabbing and video saving will not start before the running mode is set to True.

If the running mode is set to False and LiveStart is called, the live video is displayed (if enabled) but no frames are passed to the sink. Now, an application can set the running mode to True to start video capturing or frame grabbing without latency because the image stream is already initialized.

See also: BaseSink

<< BaseSink


BaseSink::SinkType

BaseSink.SinkType Method
This property returns a member of the BaseSinkTypes enumeration that describes the type of this sink object.
Syntax:
Public SinkType As BaseSinkTypes
See also: BaseSink, BaseSinkTypes

<< BaseSink


FrameFilter

FrameFilter is the class provides the interface to a filter that was loaded from a filter module. It contains methods to access the filter's parameters, display a configuration dialog and save filter settings.

To create a frame filter, use ICImagingControl.FrameFilterCreate or ICImagingControl.FrameFilterCreateString.

Example

The following example illustrates how to create an instance of the first available frame filter and set it as device frame filter:

' Retrieve the first FrameFilterInfo object.
Dim info As FrameFilterInfo
Set info = ICImagingControl1.FrameFilterInfos(1)

' Create the frame filter to which the info object refers.
Dim filter As FrameFilter
Set filter = ICImagingControl1.FrameFilterCreate(info)

' Set the frame filter as the device frame filter.
ICImagingControl1.DeviceFrameFilters.Add filter

' Start live mode.
ICImagingControl1.LiveStart

Information

Introduced in IC Imaging Control 3.0

Properties

Property | Description
AvailableParameters | Returns a list, containing the names of the available frame filter parameters.
Data | Returns or sets a blob of raw data.
DataSize | Returns the size of the array returned by FrameFilter.Data.
FilterData | This property returns an XML formatted string, containing the current values of all parameters of this filter.
FilterInfo | Returns the FrameFilterInfo describing this filter.
HasDialog | Returns whether this frame filter has a built-in dialog that allows the user to modify the filter's parameters.
Name | Returns the name of this frame filter.
Parameter | Sets or gets the value of a parameter.

Methods

Method | Description
BeginParameterTransfer | BeginParameterTransfer and EndParameterTransfer synchronize the access to a frame filter's parameters.
EndParameterTransfer | BeginParameterTransfer and EndParameterTransfer synchronize the access to a frame filter's parameters.
LoadFilterData | Loads filter settings from a file.
SaveFilterData | Saves the current values of all parameters of this filter in a file.
ShowDialog | Displays a dialog that lets the user configure the filter.

<< Classes


FrameFilter::AvailableParameters

FrameFilter.AvailableParameters Property
Returns a list, containing the names of the available frame filter parameters.
Syntax:
Public AvailableParameters As BStrCollection
Limitations:

Read only.
See also: FrameFilter, FrameFilter.Parameter

<< FrameFilter


FrameFilter::Data

FrameFilter.Data Property
Returns or sets a blob of raw data.
Syntax:
Public Data As Variant
Remarks:

A list containing the names of the available parameters can be retrieved from FrameFilter.AvailableParameters.

See also: FrameFilter, FrameFilter.DataSize, FrameFilter.AvailableParameters

<< FrameFilter


FrameFilter::DataSize

FrameFilter.DataSize Property
Returns the size of the array returned by FrameFilter.Data.
Syntax:
Public DataSize As Long
Remarks:

A list, containing the names of the available parameters can be retrieved from FrameFilter.AvailableParameters.

See also: FrameFilter, FrameFilter.Data, FrameFilter.AvailableParameters

<< FrameFilter


FrameFilter::FilterData

FrameFilter.FilterData Property
This property returns an XML formatted string, containing the current values of all parameters of this filter.
Syntax:
Public FilterData As String
Remarks:

The string returned by this property can be set later to restore the filter's settings.

See also: FrameFilter, FrameFilter.SaveFilterData, FrameFilter.LoadFilterData

<< FrameFilter


FrameFilter::FilterInfo

FrameFilter.FilterInfo Property
Returns the FrameFilterInfo describing this filter.
Syntax:
Public FilterInfo As FrameFilterInfo
See also: FrameFilter, FrameFilterInfo

<< FrameFilter


FrameFilter::HasDialog

FrameFilter.HasDialog Property
Returns whether this frame filter has a built-in dialog that allows the user to modify the filter's parameters.
Syntax:
Public HasDialog As Boolean
Limitations:

Read only.
Remarks:

FrameFilter.ShowDialog only works when this method returns True.

See also: FrameFilter, FrameFilter.ShowDialog

<< FrameFilter


FrameFilter::Name

FrameFilter.Name Property
Returns the name of this frame filter.
Syntax:
Public Name As String
Limitations:

Read only.
Remarks:

This method returns the same as FilterInfo.Name.

See also: FrameFilter, FrameFilter.FilterInfo

<< FrameFilter


FrameFilter::Parameter

FrameFilter.Parameter Property
Sets or gets the value of a parameter.
Syntax:
Public Parameter As Variant
Remarks:

A list containing the names of the available parameters can be retrieved from FrameFilter.AvailableParameters.

Example:

The following example shows how to set the parameters of the Rotate Flip Filter. Please not that the access to the Parameter properties is enclosed in BeginParameterTransfer and EndParameterTransfer.

filter.BeginParameterTransfer

filter.Parameter("Rotation Angle") = 180
filter.Parameter("Flip H") = False
filter.Parameter("Flip V") = False

filter.EndParameterTransfer
See also: FrameFilter, FrameFilter.AvailableParameters, FrameFilter.BeginParameterTransfer, FrameFilter.EndParameterTransfer

<< FrameFilter


FrameFilter::BeginParameterTransfer

FrameFilter.BeginParameterTransfer Method
BeginParameterTransfer and EndParameterTransfer synchronize the access to a frame filter's parameters.
Syntax:
Public Sub BeginParameterTransfer()
Remarks:

This method acquires a lock that has to be released using EndParameterTransfer as soon as possible.

Example:

For an example of how to set or read parameters, see FrameFilter.Parameter.

See also: FrameFilter, FrameFilter.EndParameterTransfer

<< FrameFilter


FrameFilter::EndParameterTransfer

FrameFilter.EndParameterTransfer Method
BeginParameterTransfer and EndParameterTransfer synchronize the access to a frame filter's parameters.
Syntax:
Public Sub EndParameterTransfer()
Example:

For an example of how to set or read parameters, see FrameFilter.Parameter.

See also: FrameFilter, FrameFilter.BeginParameterTransfer

<< FrameFilter


FrameFilter::LoadFilterData

FrameFilter.LoadFilterData Method
Loads filter settings from a file.
Syntax:
Public Sub LoadFilterData( Filename As String )
Remarks:

Filter settings files are created by FrameFilter.SaveFilterData.

See also: FrameFilter, FrameFilter.SaveFilterData, FrameFilter.FilterData

<< FrameFilter


FrameFilter::SaveFilterData

FrameFilter.SaveFilterData Method
Saves the current values of all parameters of this filter in a file.
Syntax:
Public Sub SaveFilterData( Filename As String )
Remarks:

This method saves the string returned by FilterData in a file.

FrameFilter.LoadFilterData can be used to restore the saved data.

See also: FrameFilter, FrameFilter.LoadFilterData, FrameFilter.FilterData

<< FrameFilter


FrameFilter::ShowDialog

FrameFilter.ShowDialog Method
Displays a dialog that lets the user configure the filter.
Syntax:
Public Sub ShowDialog()
Remarks:

You should only call this method, if HasDialog returns true.

See also: FrameFilter, FrameFilter.HasDialog

<< FrameFilter


FrameFilterInfo

A FrameFilterInfo object contains information about a frame filter that can be loaded from a frame filter module and instantiated, using ICImagingControl.FrameFilterCreate.

A list of FrameFilterInfo objects for all available frame filters can be obtained from ICImagingControl.FrameFilterInfos.

Information

Introduced in IC Imaging Control 3.0

Properties

Property | Description
ModuleName | Returns the filename of the module from which the filter can be loaded.
ModulePath | Returns the complete path to the module from which the filter can be loaded.
Name | Returns the name of the frame filter.

<< Classes


FrameFilterInfo::ModuleName

FrameFilterInfo.ModuleName Property
Returns the filename of the module from which the filter can be loaded.
Syntax:
Public ModuleName As String
Limitations:

Read only.
See also: FrameFilterInfo, FrameFilterInfo.ModulePath

<< FrameFilterInfo


FrameFilterInfo::ModulePath

FrameFilterInfo.ModulePath Property
Returns the complete path to the module from which the filter can be loaded.
Syntax:
Public ModulePath As String
Limitations:

Read only.
See also: FrameFilterInfo, FrameFilterInfo.ModuleName

<< FrameFilterInfo


FrameFilterInfo::Name

FrameFilterInfo.Name Property
Returns the name of the frame filter.
Syntax:
Public Name As String
Limitations:

Read only.
See also: FrameFilterInfo

<< FrameFilterInfo


FrameFilterInfos

The FrameFilterInfos class contains FrameFilterInfo objectsm describing frame filters that can be loaded from an existing module.

ICImagingControl.FrameFilterInfos returns an instance of FrameFilterInfos.

Information

Introduced in IC Imaging Control 3.0

Properties

Property | Description
Count | Returns the count of FrameFilterInfo objects in the collection.
Item | Returns the FrameFilterInfo at the specified position.

<< Classes


FrameFilterInfos::Count

FrameFilterInfos.Count Property
Returns the count of FrameFilterInfo objects in the collection.
Syntax:
Public Count As Long
Limitations:

Read only.
See also: FrameFilterInfos, FrameFilterInfo

<< FrameFilterInfos


FrameFilterInfos::Item

FrameFilterInfos.Item Property
Returns the FrameFilterInfo at the specified position.
Syntax:
Public Item(Index As Long) As FrameFilterInfo

Parameter | Description
Index | Specifies the Index of the FrameFilterInfo to return. The Index must lie in int the range [1, FrameFilterInfos.Count ], otherwise an error occurs.
Limitations:

Read only.
See also: FrameFilterInfos, FrameFilterInfos.Count, FrameFilterInfo

<< FrameFilterInfos


FrameFilters

The FrameFilters class represents a chain of FrameFilter objects, that are used to transform the image data along the Device Path, Sink Path and Display Path.

Instances of FrameFilters can be accessed through ICImagingControl.DeviceFrameFilters, ICImagingControl.DisplayFrameFilters, MediaStreamSink.FrameFilters and FrameHandlerSink.FrameFilters.

The FrameFilters collection can not be modified when live mode is running.

Information

Introduced in IC Imaging Control 3.0

Properties

Property | Description
Count | Returns the number of FrameFilter objects in the collection.
Item | Returns or sets the FrameFilter at the specified position.

Methods

Method | Description
Add | Inserts a FrameFilter object at the end of the collection.
Clear | Removes all FrameFilter objects from the collection.
Remove | Removes the FrameFilter at a specified position.

<< Classes


FrameFilters::Count

FrameFilters.Count Property
Returns the number of FrameFilter objects in the collection.
Syntax:
Public Count As Long
Limitations:

Read only.
See also: FrameFilters, FrameFilter

<< FrameFilters


FrameFilters::Item

FrameFilters.Item Property
Returns or sets the FrameFilter at the specified position.
Syntax:
Public Item(Index As Long) As FrameFilter

Parameter | Description
Index | Specifies the Index of the FrameFilter to set or return. The Index must lie in int the range [1, FrameFilters.Count ], otherwise an error occurs.
Limitations:

Read only in live mode.

See also: FrameFilters, FrameFilters.Count, FrameFilter

<< FrameFilters


FrameFilters::Add

FrameFilters.Add Method
Inserts a FrameFilter object at the end of the collection.
Syntax:
Public Sub Add( Filter As FrameFilter )

Parameter | Description
Filter | Specifies the FrameFilter that is inserted into the collection.
Limitations:

Not available in live mode.

See also: FrameFilters, FrameFilters.Remove, FrameFilters.Clear

<< FrameFilters


FrameFilters::Clear

FrameFilters.Clear Method
Removes all FrameFilter objects from the collection.
Syntax:
Public Sub Clear()
Limitations:

Not available in live mode.

See also: FrameFilters, FrameFilters.Add, FrameFilters.Remove

<< FrameFilters


FrameFilters::Remove

FrameFilters.Remove Method
Removes the FrameFilter at a specified position.
Syntax:
Public Sub Remove( Index As Long )

Parameter | Description
Index | Specifies the index of the FrameFilter to be removed.
Limitations:

Not available in live mode.

See also: FrameFilters, FrameFilters.Add, FrameFilters.Clear

<< FrameFilters


FrameHandlerSink

The FrameHandlerSink is the SinkType used to grab (copy) frames from the image stream. It contains an ImageBuffer collection and optionally allows you to specify one or more FrameFilters that are responsible for copying the image data to the ImageBuffers. The FrameFilter implementation can perform user-defined transformations while copying the data, and they can intentionally drop unwanted frames. If no frame filter is registered, the frames are copied to the ImageBuffer collection without being changed.

Frames are copied one after another to the ImageBuffer collection, starting with the first buffer of the collection. When a frame is copied into the last buffer, the next frame is copied to the first buffer and so on.

The FrameHandlerSink can operate in snap mode or in grab mode. The mode can be toggled by using the FrameHandlerSink.SnapMode property. In grab mode, frames are copied continuously to the ImageBuffers, as soon as ICImagingControl.LiveStart is called. A call to ICImagingControl.LiveStop ends the copy process. On the other hand, in snap mode, every call to FrameHandlerSink.SnapImage, FrameHandlerSink.SnapImageSequence or FrameHandlerSink.SnapImageSequenceAsync copies the specified number of frames to the ImageBuffers.

Information

Introduced in IC Imaging Control 3.0

Inheritance

BaseSink
FrameHandlerSink

Properties

Property | Description
BufferCount | Returns and sets the number of buffers in FrameHandlerSink.ImageBuffers.
FrameCount | Returns the total number of frames that this sink processed since the last call of ICImagingControl.LiveStart.
FrameFilters | Returns a frame filter collection. The last filter in the collection is responsible to copy the image data to the Membuffer collection while the others are used to manipulate the image data that go to the sink.
FrameTypes | The FrameTypes collections allows the specification of valid image formats for the ImageBuffer collection.
ImageBuffers | Returns the collections of ImageBuffer objects in this sink.
LastAcquiredBuffer | Returns the ImageBuffer in which the last frame was fully copied. After stopping the sink, this function returns the last acquired frame until the sink is restarted.
SnapMode | Changes this sink's operating mode between Grab and Snap mode. In grab mode, all frames reaching the sink are presented to the frame filter or filter chain and then copied into the ImageBuffers. After that, the ICImagingControl.ImageAvailable event is raised. In snap mode, SnapImage, SnapImageSequence or SnapImageSequenceAsync has to be called in order to trigger the image acquisition process.

Methods

Method | Description
SnapImage | Queues up a snap job, thus allowing one frame to be copied into the ImageBuffer collection. The method returns when either the frame was snapped, or the timeout has occurred.
SnapImageSequence | Queues up a snap job, thus allowing a number of frames to be copied into the ImageBuffer collection. The method returns when either the specified number of frames are snapped, or the timeout has occurred.
SnapImageSequenceAsync | Queues up a snap job, thus copying a number of frames into the ImageBuffer collection. The method returns immediately after queuing the job.

<< Classes


FrameHandlerSink::BufferCount

FrameHandlerSink.BufferCount Property
Returns and sets the number of buffers in FrameHandlerSink.ImageBuffers.
Syntax:
Public BufferCount As Long
See also: FrameHandlerSink

<< FrameHandlerSink


FrameHandlerSink::FrameCount

FrameHandlerSink.FrameCount Property
Returns the total number of frames that this sink processed since the last call of ICImagingControl.LiveStart.
Syntax:
Public FrameCount As Long
Limitations:

Read only.
See also: FrameHandlerSink

<< FrameHandlerSink


FrameHandlerSink::FrameFilters

FrameHandlerSink.FrameFilters Property
Returns a frame filter collection. The last filter in the collection is responsible to copy the image data to the Membuffer collection while the others are used to manipulate the image data that go to the sink.
Syntax:
Public FrameFilters As FrameFilters
Limitations:

Read only.
See also: FrameHandlerSink, FrameFilters, FrameFilter

<< FrameHandlerSink


FrameHandlerSink::FrameTypes

FrameHandlerSink.FrameTypes Property
The FrameTypes collections allows the specification of valid image formats for the ImageBuffer collection.
Syntax:
Public FrameTypes As FrameTypes
Limitations:

Read only.
Example:

The following example shows how to setup a FrameHandlerSink that only accepts the 8-bit-gray image formats Y800 and RGB8.

Dim fhs As New FrameHandlerSink

Dim ftY800 As New FrameType
ftY800.Type = "Y800"
fhs.FrameTypes.Add ftY800
Dim ftRGB8 As New FrameType
ftRGB8.Type = "RGB8"
fhs.FrameTypes.Add ftRGB8

ICImagingControl1.Sink = fhs

ICImagingControl1.LiveStart

To let a sink only accept images in the bayer format BY8, the following source code can be used:

Dim fhs As New FrameHandlerSink

Dim ftBY8 As New FrameType
ftBY8.Type = "BY8"
fhs.FrameTypes.Add ftBY8

ICImagingControl1.Sink = fhs

ICImagingControl1.LiveStart
See also: FrameHandlerSink, FrameTypes

<< FrameHandlerSink


FrameHandlerSink::ImageBuffers

FrameHandlerSink.ImageBuffers Property
Returns the collections of ImageBuffer objects in this sink.
Syntax:
Public ImageBuffers As ImageBuffers
Limitations:

Read only.
See also: FrameHandlerSink, ImageBuffers

<< FrameHandlerSink


FrameHandlerSink::LastAcquiredBuffer

FrameHandlerSink.LastAcquiredBuffer Property
Returns the ImageBuffer in which the last frame was fully copied. After stopping the sink, this function returns the last acquired frame until the sink is restarted.
Syntax:
Public LastAcquiredBuffer As ImageBuffer
Limitations:

Read only.
Remarks:

If an error occurs, the exception INVALID_MEMBUFFER is thrown.

Example:

The following example shows how to save the last acquired image in a JPG file:

Dim fhs As New FrameHandlerSink
fhs.SnapMode = False

ICImagingControl1.Sink = fhs
ICImagingControl1.LiveStart

' Do something, wait for user action, ...

ICImagingControl1.LiveStop

' Save the last aquired image to a JPG file.
fhs.LastAcquiredBuffer.SaveAsJpeg "last.jpg", 75
See also: FrameHandlerSink, FrameHandlerSink.ImageBuffers, ImageBuffer

<< FrameHandlerSink


FrameHandlerSink::SnapMode

FrameHandlerSink.SnapMode Property
Changes this sink's operating mode between Grab and Snap mode. In grab mode, all frames reaching the sink are presented to the frame filter or filter chain and then copied into the ImageBuffers. After that, the ICImagingControl.ImageAvailable event is raised. In snap mode, SnapImage, SnapImageSequence or SnapImageSequenceAsync has to be called in order to trigger the image acquisition process.
Syntax:
Public SnapMode As Boolean
See also: FrameHandlerSink, ImageBuffer, ICImagingControl.ImageAvailable

<< FrameHandlerSink


FrameHandlerSink::SnapImage

FrameHandlerSink.SnapImage Method
Queues up a snap job, thus allowing one frame to be copied into the ImageBuffer collection. The method returns when either the frame was snapped, or the timeout has occurred.
Syntax:
Public Sub SnapImage( TimeOut As Long )

Parameter | Description
TimeOut | Number of milliseconds to wait before returning from this function, if no frames are available from the device.
See also: FrameHandlerSink, FrameHandlerSink.SnapImageSequence, FrameHandlerSink.SnapImageSequenceAsync

<< FrameHandlerSink


FrameHandlerSink::SnapImageSequence

FrameHandlerSink.SnapImageSequence Method
Queues up a snap job, thus allowing a number of frames to be copied into the ImageBuffer collection. The method returns when either the specified number of frames are snapped, or the timeout has occurred.
Syntax:
Public Sub SnapImageSequence( Count As Long, TimeOut As Long )

Parameter | Description
Count | Number of frames to be copied into the image buffers.
TimeOut | Number of milliseconds to wait before returning from this function, when insufficient frames are available from the device.
See also: FrameHandlerSink, FrameHandlerSink.SnapImage, FrameHandlerSink.SnapImageSequenceAsync

<< FrameHandlerSink


FrameHandlerSink::SnapImageSequenceAsync

FrameHandlerSink.SnapImageSequenceAsync Method
Queues up a snap job, thus copying a number of frames into the ImageBuffer collection. The method returns immediately after queuing the job.
Syntax:
Public Sub SnapImageSequenceAsync( Count As Long )

Parameter | Description
Count | Number of frames to be copied into the image buffers.
Remarks:

You cannot terminate this snap job unless you stop live mode by calling ICImagingControl.LiveStop.

See also: FrameHandlerSink, FrameHandlerSink.SnapImage, FrameHandlerSink.SnapImageSequence

<< FrameHandlerSink


FrameType

A FrameType describes the color format and (optionally) dimensions and buffer size of the image format of ImageBuffer objects.

Information

Introduced in IC Imaging Control 3.0

Properties

Property | Description
BitsPerPixel | Returns the number of bits needed to store one pixel in this frame type.
BufferSize | Returns or sets the number of bytes that is needed to store one frame of image data in this frame type.
Height | Returns or sets height of a frame.
IsBottomUp | Returns whether this frame type stores the image data bottom up.
Name | The name of this frame type.
SubtypeGUID | Returns or sets the GUID of the video subtype of this frame type.
Type | Returns or sets the name of the color format of this frame type.
Width | Returns or sets width of a frame.

<< Classes


FrameType::BitsPerPixel

FrameType.BitsPerPixel Property
Returns the number of bits needed to store one pixel in this frame type.
Syntax:
Public BitsPerPixel As Long
Limitations:

Read only.
Remarks:

The bit depth depends on the FrameType.Type or FrameType.SubtypeGUID property.

See also: FrameType

<< FrameType


FrameType::BufferSize

FrameType.BufferSize Property
Returns or sets the number of bytes that is needed to store one frame of image data in this frame type.
Syntax:
Public BufferSize As Long
See also: FrameType

<< FrameType


FrameType::Height

FrameType.Height Property
Returns or sets height of a frame.
Syntax:
Public Height As Long
See also: FrameType, FrameType.Width

<< FrameType


FrameType::IsBottomUp

FrameType.IsBottomUp Property
Returns whether this frame type stores the image data bottom up.
Syntax:
Public IsBottomUp As Boolean
Limitations:

Read only.
Remarks:

For bottom up frame types. the first bytes of the image buffer contain the image data of the last row of the image. In images with a top down frame type, the first bytes of the image buffer contain the image data of the first row of the image.

See also: FrameType

<< FrameType


FrameType::Name

FrameType.Name Property
The name of this frame type.
Syntax:
Public Name As String
Remarks:

Valid frame types names are strings like Y800 (640x480), RGB24 (1024x768) or UYVY (320x240).

See also: FrameType

<< FrameType


FrameType::SubtypeGUID

FrameType.SubtypeGUID Property
Returns or sets the GUID of the video subtype of this frame type.
Syntax:
Public SubtypeGUID As String
See also: FrameType, FrameType.Type

<< FrameType


FrameType::Type

FrameType.Type Property
Returns or sets the name of the color format of this frame type.
Syntax:
Public Type As String
Remarks:

Valid types are strings like Y800, RGB24 or UYVY.

See also: FrameType, FrameType.SubtypeGUID

<< FrameType


FrameType::Width

FrameType.Width Property
Returns or sets width of a frame.
Syntax:
Public Width As Long
See also: FrameType, FrameType.Height

<< FrameType


FrameTypes

The FrameTypes collection is used to define a list of FrameTypes. A FrameTypes collection is used, i.e. to determine which FrameTypes are accepted by a frame filter or a sink.

Information

Introduced in IC Imaging Control 3.0

Properties

Property | Description
Count | Returns the number of FrameType objects in the collection.
Item | Returns or sets the FrameType at the specified position.

Methods

Method | Description
Add | Inserts a FrameType object at the end of the collection.
Clear | Removes all FrameType objects from the collection.
Remove | Removes the FrameType at a specified position.

<< Classes


FrameTypes::Count

FrameTypes.Count Property
Returns the number of FrameType objects in the collection.
Syntax:
Public Count As Long
Limitations:

Read only.
See also: FrameTypes, FrameType

<< FrameHandlerSink.FrameTypes


FrameTypes::Item

FrameTypes.Item Property
Returns or sets the FrameType at the specified position.
Syntax:
Public Item(Index As Long) As FrameType

Parameter | Description
Index | Specifies the Index of the FrameType to set or return. The Index must lie in the range [1, FrameTypes.Count ], otherwise an error occurs.
See also: FrameTypes, FrameTypes.Count, FrameType

<< FrameHandlerSink.FrameTypes


FrameTypes::Add

FrameTypes.Add Method
Inserts a FrameType object at the end of the collection.
Syntax:
Public Sub Add( NewType As FrameType )

Parameter | Description
Filter | Specifies the FrameType that is inserted into the collection.
See also: FrameTypes, FrameTypes.Remove, FrameTypes.Clear

<< FrameHandlerSink.FrameTypes


FrameTypes::Clear

FrameTypes.Clear Method
Removes all FrameType objects from the collection.
Syntax:
Public Sub Clear()
See also: FrameTypes, FrameTypes.Add, FrameTypes.Remove

<< FrameHandlerSink.FrameTypes


FrameTypes::Remove

FrameTypes.Remove Method
Removes the FrameType at a specified position.
Syntax:
Public Sub Remove( Index As Long )

Parameter | Description
Index | Specifies the index of the FrameType to be removed.
See also: FrameTypes, FrameTypes.Add, FrameTypes.Clear

<< FrameHandlerSink.FrameTypes


MediaStreamContainer

A MediaStreamContainer describes a video file format. The most common video file format is AVI.

A list of valid MediaStreamContainer objects can be obtained from ICImagingControl.MediaStreamContainers.

Example

The following code fragment shows how to create a MediaStreamSink to record an AVI file:

' Create the MediaStreamSink.
Dim aviSink As New MediaStreamSink

' Set AVI as the video file format
Dim n As Integer
n = ICImagingControl1.MediaStre.mContainers.FindIndex("AVI")
aviSink.StreamContainer = ICImagingControl1.MediaStreamContainers(n)

' Set DV Video Encoder as the Codec
n = ICImagingControl1.AviCompressors.FindIndex("DV Video Encoder")
aviSink.Codec = ICImagingControl1.AviCompressors(n)

' Set a target file name.
aviSink.FileName = "video.avi"

' Set the sink.
ICImagingControl1.Sink = aviSink

' Start recording.
ICImagingControl1.LiveStart

Information

Introduced in IC Imaging Control 3.0

Properties

Property | Description
CustomCodecSupported | Returns whether this MediaStreamContainer allows an AviCompressor to be used to compress the recorded video.
ID | Returns a string containing the GUID of this MediaStreamContainer
Name | Returns the name of the MediaStreamContainer.
PreferredFileExtension | Returns the default file extension for video files that have been saved using this MediaStreamContainer.

<< Classes


MediaStreamContainer::CustomCodecSupported

MediaStreamContainer.CustomCodecSupported Property
Returns whether this MediaStreamContainer allows an AviCompressor to be used to compress the recorded video.
Syntax:
Public CustomCodecSupported As Boolean
Limitations:

Read only.
Remarks:

When this property is True, an AviCompressor can be assigned to MediaStreamSink.Codec after this MediaStreamContainer has been assigned to MediaStreamSink.StreamContainer.

See also: MediaStreamContainer, MediaStreamSink.StreamContainer, MediaStreamSink.Codec

<< MediaStreamContainer


MediaStreamContainer::ID

MediaStreamContainer.ID Property
Returns a string containing the GUID of this MediaStreamContainer
Syntax:
Public ID As String
Limitations:

Read only.
See also: MediaStreamContainer

<< MediaStreamContainer


MediaStreamContainer::Name

MediaStreamContainer.Name Property
Returns the name of the MediaStreamContainer.
Syntax:
Public Name As String
Limitations:

Read only.
Remarks:

The name of a media stream container should not be used for identification purposes. Use the MediaStreamContainer.ID property to remember, which media stream container is currently being used. This will ensure that your code remains independent of the actual device name.

See also: MediaStreamContainer

<< MediaStreamContainer


MediaStreamContainer::PreferredFileExtension

MediaStreamContainer.PreferredFileExtension Property
Returns the default file extension for video files that have been saved using this MediaStreamContainer.
Syntax:
Public PreferredFileExtension As String
Limitations:

Read only.
Remarks:

The value of this property can be used to customize the dialog displayed to let the user select a video filename.

See also: MediaStreamContainer

<< MediaStreamContainer


MediaStreamContainers

MediaStreamContainers is a collection of MediaStreamContainer objects. The collection contains all available media stream containers. The ICImagingControl.MediaStreamContainers property returns a MediaStreamContainers collection.

Information

Introduced in IC Imaging Control 3.0

Properties

Property | Description
Count | Returns the number of MediaStreamContainer objects in the collection.
Item | Returns the MediaStreamContainer at the specified position.

Methods

Method | Description
FindIndex | Searches the collection for a given string. The string contains the name of a MediaStreamContainer.

<< Classes


MediaStreamContainers::Count

MediaStreamContainers.Count Property
Returns the number of MediaStreamContainer objects in the collection.
Syntax:
Public Count As Long
Limitations:

Read only.
See also: MediaStreamContainers, MediaStreamContainer

<< ICImagingControl.MediaStreamContainers


MediaStreamContainers::Item

MediaStreamContainers.Item Property
Returns the MediaStreamContainer at the specified position.
Syntax:
Public Item(Index As Long) As MediaStreamContainer

Parameter | Description
Index | Specifies the Index of the MediaStreamContainer to return. The Index must lie in the range [1, MediaStreamContainers.Count ], otherwise an error occurs.
Limitations:

Read only.
See also: MediaStreamContainers, MediaStreamContainers.Count, MediaStreamContainer

<< ICImagingControl.MediaStreamContainers


MediaStreamContainers::FindIndex

MediaStreamContainers.FindIndex Method
Searches the collection for a given string. The string contains the name of a MediaStreamContainer.
Syntax:
Public Function FindIndex(Name As String) As Long

Parameter | Description
Name | Specifies the name of the MediaStreamContainer for which to search in the collection.
Return Value:

If the Name property of a MediaStreamContainer object is equal to the given string, the FindIndex method returns the index of this object in the collection. If the string is not found, the FindIndex method returns -1.

See also: MediaStreamContainers, MediaStreamContainer

<< ICImagingControl.MediaStreamContainers


MediaStreamSink

The MediaStreamSink allows video files to be recorded in a more sophisticated manor than is possible using AviStartCapture and AviStopCapture. However, for simple tasks, the methods AviStartCapture and AviStopCapture are better suited, as they are really easy to use. A MediaStreamSink can save image data to video files in various formats and optionally allows you to specify one or more FrameFilters that can analyze and/or transform the image data, before it is written to the video file.

The FrameFilter implementation can also drop certain frames, thus enabling lapse recording applications to be easily authored. The video file format is specified by a MediaStreamContainer, while the format of the image data in the file is determined by a codec, represented as an AviCompressor object. The MediaStreamContainer determines the video file format; the most common MediaStreamContainer is AVI. Many media stream containers allow the specification of an AviCompressor to compress the image data before writing it to the file.

Example

The following code fragment shows how to create a MediaStreamSink to record an AVI file:

' Create the MediaStreamSink.
Dim aviSink As New MediaStreamSink

' We do not set aviSink.StreamContainer to record an AVI file,
' as AVI is the default file format.

' Set the DV Video Encoder as the codec.
Dim n As Integer
n = ICImagingControl1.AviCompressors.FindIndex("DV Video Encoder")
aviSink.Codec = ICImagingControl1.AviCompressors(n)

' Set a target file name.
aviSink.FileName = "video.avi"

' Set the sink.
ICImagingControl1.Sink = aviSink

' Start recording.
ICImagingControl1.LiveStart

Information

Introduced in IC Imaging Control 3.0

Inheritance

BaseSink
MediaStreamSink

Properties

Property | Description
Codec | Returns or sets the used AviCompressor.
Filename | Returns or sets the name of the target video file.
FrameFilters | The FrameFilters property grants access to a FrameFilters collection that can be used to manipulate the filter chain used to transform the image data, before it is written to the video file.
StreamContainer | Returns or sets the used MediaStreamContainer.

<< Classes


MediaStreamSink::Codec

MediaStreamSink.Codec Property
Returns or sets the used AviCompressor.
Syntax:
Public Codec As AviCompressor
Limitations:

Read only in live mode.
See also: MediaStreamSink, AviCompressor

<< MediaStreamSink


MediaStreamSink::Filename

MediaStreamSink.Filename Property
Returns or sets the name of the target video file.
Syntax:
Public Filename As String
Limitations:

Read only in live mode.

See also: MediaStreamSink

<< MediaStreamSink


MediaStreamSink::FrameFilters

MediaStreamSink.FrameFilters Property
The FrameFilters property grants access to a FrameFilters collection that can be used to manipulate the filter chain used to transform the image data, before it is written to the video file.
Syntax:
Public FrameFilters As FrameFilters
Limitations:

Read only.

The filter chain can not be changed in live mode.
Example:

See ICImagingControl.FrameFilterCreate for an example that illustrates how to create a frame filter and insert the filter into a FrameFilters collection.

See also: MediaStreamSink, FrameFilters, FrameFilter

<< MediaStreamSink


MediaStreamSink::StreamContainer

MediaStreamSink.StreamContainer Property
Returns or sets the used MediaStreamContainer.
Syntax:
Public StreamContainer As MediaStreamContainer
Limitations:

Read only in live mode.
See also: MediaStreamSink, MediaStreamContainer

<< MediaStreamSink


New Enumerations

List of all enumerations that have been introduced in IC Imaging Control 3.0

refenum.BaseSinkTypes

The BaseSinkTypes enumeration members identify the sink types.

refenum.DeBayerModes

The DeBayerModes enumeration is used to set the debayering algorithm.

refenum.DeBayerStartPatterns

Enumeration containing all possible bayer start patterns of the first row of the image data.

refenum.PathPositions

PathPositions enumerates the possible positions of the OverlayBitmap in the image stream.

refenum.OverlayColorModes

The members of this enumeration are used to set the color format of the OverlayBitmap, using OverlayBitmap.ColorMode.

<< New Features Reference


refenum::BaseSinkTypes

refenum.BaseSinkTypes
The BaseSinkTypes enumeration members identify the sink types.
Name | Description
BASESINKTYPE_FRAMEHANDLERSINK | The sink type is an instance of FrameHandlerSink.
BASESINKTYPE_MEDIASTREAMSINK | The sink type is an instance of MediaStreamSink.

<< Enumerations


refenum::DeBayerModes

refenum.DeBayerModes
The DeBayerModes enumeration is used to set the debayering algorithm.
Name | Description
DEBAYER_NEARESTCOLOR | Simplest and fastest algorithm, but inferior output image quality.
DEBAYER_BILINEAR | Algorithm with both acceptable speed and image quality.
DEBAYER_EDGESENSING | This algorithm creates the best image quality, but is rather slow.

<< Enumerations


refenum::DeBayerStartPatterns

refenum.DeBayerStartPatterns
Enumeration containing all possible bayer start patterns of the first row of the image data.
Name | Description
DEBAYERPATTERN_BG | The first two pixels of the pattern are interpreted as blue and green.
DEBAYERPATTERN_GB | The first two pixels of the pattern are interpreted as green and blue.
DEBAYERPATTERN_GR | The first two pixels of the pattern are interpreted as green and red.
DEBAYERPATTERN_RG | The first two pixels of the pattern are interpreted as red and green.

<< Enumerations


refenum::PathPositions

refenum.PathPositions
PathPositions enumerates the possible positions of the OverlayBitmap in the image stream.
Name | Description
PATHPOSITION_NONE | The OverlayBitmap will not be visible at all.
PATHPOSITION_DEVICE | The OverlayBitmap will be visible in both the live video display and grabbed images/videos.
PATHPOSITION_SINK | The OverlayBitmap will be visible in grabbed images and videos, but not in the live display.
PATHPOSITION_DISPLAY | The OverlayBitmap will be visible in the live display, but not in grabbed images or videos.

<< Enumerations


refenum::OverlayColorModes

refenum.OverlayColorModes
The members of this enumeration are used to set the color format of the OverlayBitmap, using OverlayBitmap.ColorMode.
Name | Description
OVERLAY_COLORMODE_BESTFIT | Let the OverlayBitmap select the best matching color format.
OVERLAY_COLORMODE_GRAYSCALE | Use grayscale mode.
OVERLAY_COLORMODE_COLOR | Use color mode.

<< Enumerations


What is new in Version 2.0

Description of the changes from IC Imaging Control 1.41 to IC Imaging Control 2.0.

.NET component

With IC Imaging Control 2.0, a .NET component is introduced that provides the same functionality as the OCX. There is separate online documentation for this component. It can be found in the IC Imaging Control start sub menu

Video Capture Device Properties

Video capture device properties provide a generic, hardware independent and extendable way to control the settings of a video capture device. In the following, the shortcut VCD is used for Video Capture Device.

DCAM Prop DLL

The DCAM Prop DLL is not needed anymore. The special DCAM features can now be accessed and manipulated using the appropriate VCD properties.

A detailed list of equivalent functionality for all functions and procedures of the DCAM Prop DLL can be found in the technical article DCAM_Prop_DLL.

LivePause

The new ICImagingControl.LivePause property allows to pause both the live display and the delivery of frames to the ImageAvailable event.

Count dropped frames

It is possible to retrieve the number of frames that have been dropped or not dropped with the new functions

  • ICImagingControl.DeviceCountOfFramesDropped
  • ICImagingControl.DeviceCountOfFramesNotDropped

Serializing the device state

A new set of functions allows the settings of the currently opened device to be saved to a string or a file and restored.

  • ICImagingControl.SaveDeviceState
  • ICImagingControl.SaveDeviceStateToFile
  • ICImagingControl.LoadDeviceState
  • ICImagingControl.LoadDeviceStateFromFile

Built-in Dialogs

ICImagingControl comes with 2 dialogs that allow the user to open a device and adjust device settings.

  • ICImagingControl.ShowDeviceSettingsDialog shows a dialog box that lets the user open a device and configure video norm, video format, input channel, frame rate and flip states.
  • ICImagingControl.ShowPropertyDialog shows a dialog allowing the user to adjust the VCD Properties.

Saving image buffers

The ImageBuffer class has 2 new methods to save the contents of the image buffer. Images can be saved to JPEG and various BMP files.

  • ImageBuffer.SaveAsJpeg
  • ImageBuffer.SaveAsBitmap

Image buffer access

The ImageBuffer class was enhanced with methods to simplify access to the image data.

The ImageBuffer.Lines and ImageBuffer.PixelPerLine properties expose information about the size of the image buffer.

With the new ImageBuffer.ImageDataPtr property, it is possible to retrieve a pointer to raw image data that has been cast to a long value. This value (containing the pointer) can be passed to C functions in a DLL for fast image processing or integration of third-party imaging libraries.

OverlayBitmap

The following methods have been added to the OverlayBitmap class:

  • OverlayBitmap.DrawFrameRect
  • OverlayBitmap.DrawSolidEllipse
  • OverlayBitmap.DrawFrameEllipse

New Features Reference

List of all new features

<< What's New


New Features Reference

List of all new features

VCDAbsoluteValueProperty

This class represents an absolute value interface to a value of a video capture device property.

VCDButtonProperty

This class represents a button interface to a video capture device property. Button interfaces allow invoking an operation at the property.

VCDCategoryMap

This class describes how items are organized in categories.

VCDMapStringsProperty

This class represents an interface to a value of a video capture device property, that uses names for the values.

VCDPropertyElement

This class represents an element of video capture device property.

VCDPropertyElements

This class is a collection of VCDPropertyElement objects.

VCDPropertyInterface

This class represents an interface to a value of a video capture device property. It is an abstract base class for several more specialized interfaces.

VCDPropertyItem

A VCDPropertyItem object provides the functionality to access a video capture device property.

VCDPropertyItems

This class contains a collection of all VCDPropertyItem objects that are supported by the currently opened device.

VCDRangeProperty

This class represents a range interface to a value of a video capture device property.

VCDSwitchProperty

This class represents a switch interface to a value of a video capture device property. A switch interface is used to enable or disable settings of a property.

BSTRCollection

This class is a collection of strings.

VCDSimpleProperty

This class wraps the concept of VCDProperties to make them easier to use.

ICImagingControl.VCDPropertyItems

Returns a VCDPropertyItems collection representing the properties of the currently opened device.

ICImagingControl.LivePause

This property suspends and restarts the current delivery of images.

ICImagingControl.SaveDeviceState

Saves the currently opened device and its settings to a string.

ICImagingControl.LoadDeviceState

Restores the device settings saved with ICImagingControl.SaveDeviceState.

ICImagingControl.SaveDeviceStateToFile

Saves the currently opened device and its settings to a file.

ICImagingControl.LoadDeviceStateFromFile

Restores the device settings saved with ICImagingControl.SaveDeviceStateToFile.

ICImagingControl.DeviceCountOfFramesDropped

Returns the number dropped frames.

ICImagingControl.DeviceCountOfFramesNotDropped

Returns the number of frames that were not dropped.

ICImagingControl.ShowDeviceSettingsDialog

This method opens a video capture device selection dialog.

ICImagingControl.ShowPropertyDialog

This method opens a dialog to adjust all properties of the currently opened video capture device.

ICImagingControl.SignalDetectedAvailable

Returns whether the current video capture device supports signal detection on its input ports.

ICImagingControl.SignalDetected

Returns whether a video signal is detected on the currently selected input channel of the selected video capture device.

ImageBuffer.SaveAsJpeg

Saves the contents of the buffer to a JPEG compressed file to disk.

ImageBuffer.SaveAsBitmap

Saves the contents of the buffer to a bitmap file on disk.

ImageBuffer.Lines

Returns the number of lines in this ImageBuffer.

ImageBuffer.PixelPerLine

Returns the number of pixels in each line of this ImageBuffer.

ImageBuffer.ImageDataPtr

Returns the address of the first byte of the image data.

OverlayBitmap.DrawFrameRect

This method draws an empty frame rectangle on the live video.

OverlayBitmap.DrawFrameEllipse

This method draws an empty frame ellipse on the live video.

OverlayBitmap.DrawSolidRect

This method draws a solid, filled rectangle on the live video.

<< What is new in Version 2.0


VCDAbsoluteValueProperty

This class represents an absolute value interface to a value of a video capture device property.

Information

Introduced in IC Imaging Control 2.0

Inheritance

VCDPropertyInterface
VCDAbsoluteValueProperty

Properties

Property | Description
Default | Returns the default value for this property.
DimFunction | Returns the dimension function, which describes how to map a linear range like a slider to the absolute values' range in order to achieve the best usability for your programs.
DimType | Returns the dimension type. This is a hint for applications how to connect this interface to UI elements like scrollbars to allow the best possible control.
RangeMax | Returns the maximum value.
RangeMin | Returns the minimum value.
Value | Returns or sets the absolute value.

<< Classes


VCDPropertyInterface

This class represents an interface to a value of a video capture device property. It is an abstract base class for several more specialized interfaces.

Information

Introduced in IC Imaging Control 2.0

Inheritance

VCDPropertyInterface
VCDAbsoluteValueProperty
VCDButtonProperty
VCDRangeProperty
VCDMapStringsProperty
VCDSwitchProperty

Properties

Property | Description
Available | Returns whether this interface is currently available for reading and/or writing operations.
InterfaceID | Returns the interface ID of this property interface.
Parent | Returns the element this interface belongs to.
ReadOnly | Returns whether this interface allows write operations.

Methods

Method | Description
Update | Updates the internal cache of the property to match the device's state.

<< Classes


VCDPropertyInterface::Available

VCDPropertyInterface.Available Property
Returns whether this interface is currently available for reading and/or writing operations.
Syntax:
Public Available As Boolean
Limitations:

Run time only.
See also: VCDPropertyInterface, VCDPropertyInterface.ReadOnly

<< VCDPropertyInterface


VCDPropertyInterface::InterfaceID

VCDPropertyInterface.InterfaceID Property
Returns the interface ID of this property interface.
Syntax:
Public InterfaceID As String
Limitations:

Run time only.
See also: VCDPropertyInterface, Standard Interface Identifier Strings

<< VCDPropertyInterface


VCDPropertyInterface::Parent

VCDPropertyInterface.Parent Property
Returns the element this interface belongs to.
Syntax:
Public Parent As VCDPropertyElement
Limitations:

Run time only.
See also: VCDPropertyInterface, VCDPropertyElement

<< VCDPropertyInterface


VCDPropertyInterface::ReadOnly

VCDPropertyInterface.ReadOnly Property
Returns whether this interface allows write operations.
Syntax:
Public ReadOnly As Boolean
Limitations:

Run time only.
See also: VCDPropertyInterface, VCDPropertyInterface.Available

<< VCDPropertyInterface


VCDPropertyInterface::Update

VCDPropertyInterface.Update Method
Updates the internal cache of the property to match the device's state.
Syntax:
Public Sub Update()
Remarks:

Some properties may be controlled externally at the device, while the VCDPropertyInterface derived class does not know about that. To prevent that inconsistency from happening, you can use this function to update the cache.

See also: VCDPropertyInterface

<< VCDPropertyInterface


VCDAbsoluteValueProperty::Default

VCDAbsoluteValueProperty.Default Property
Returns the default value for this property.
Syntax:
Public Default As Double
Limitations:

Run time only, read only.
See also: VCDAbsoluteValueProperty, VCDAbsoluteValueProperty.Value

<< VCDAbsoluteValueProperty


VCDAbsoluteValueProperty::DimFunction

VCDAbsoluteValueProperty.DimFunction Property
Returns the dimension function, which describes how to map a linear range like a slider to the absolute values' range in order to achieve the best usability for your programs.
Syntax:
Public DimFunction As Long
Limitations:

Run time only, read only.
Remarks:

The DimFunction value is a member of the AbsDimFunction enumeration.

See also: VCDAbsoluteValueProperty

<< VCDAbsoluteValueProperty


VCDAbsoluteValueProperty::DimType

VCDAbsoluteValueProperty.DimType Property
Returns the dimension type. This is a hint for applications how to connect this interface to UI elements like scrollbars to allow the best possible control.
Syntax:
Public DimType As String
Limitations:

Run time only, read only.
See also: VCDAbsoluteValueProperty

<< VCDAbsoluteValueProperty


VCDAbsoluteValueProperty::RangeMax

VCDAbsoluteValueProperty.RangeMax Property
Returns the maximum value.
Syntax:
Public RangeMax As Double
Limitations:

Run time only, read only.
See also: VCDAbsoluteValueProperty, VCDAbsoluteValueProperty.RangeMin

<< VCDAbsoluteValueProperty


VCDAbsoluteValueProperty::RangeMin

VCDAbsoluteValueProperty.RangeMin Property
Returns the minimum value.
Syntax:
Public RangeMin As Double
Limitations:

Run time only, read only.
See also: VCDAbsoluteValueProperty, VCDAbsoluteValueProperty.RangeMax

<< VCDAbsoluteValueProperty


VCDAbsoluteValueProperty::Value

VCDAbsoluteValueProperty.Value Property
Returns or sets the absolute value.
Syntax:
Public Value As Double
Limitations:

Run time only.
See also: VCDAbsoluteValueProperty, VCDAbsoluteValueProperty.RangeMin, VCDAbsoluteValueProperty.RangeMax, VCDAbsoluteValueProperty.Default

<< VCDAbsoluteValueProperty


VCDButtonProperty

This class represents a button interface to a video capture device property. Button interfaces allow invoking an operation at the property.

Information

Introduced in IC Imaging Control 2.0

Inheritance

VCDPropertyInterface
VCDButtonProperty

Methods

Method | Description
Push | Invokes the operation controlled by this interface.

<< Classes


VCDButtonProperty::Push

VCDButtonProperty.Push Method
Invokes the operation controlled by this interface.
Syntax:
Public Sub Push
See also: VCDButtonProperty

<< VCDButtonProperty


VCDCategoryMap

This class describes how items are organized in categories.

Information

Introduced in IC Imaging Control 2.0

Properties

Property | Description
Categories | Returns a list of all property item categories of the opened device.
ItemsInCategory | Returns a collection with the names of the VCDPropertyItems objects in a specified category.

<< Classes


VCDCategoryMap::Categories

VCDCategoryMap.Categories Property
Returns a list of all property item categories of the opened device.
Syntax:
Public Categories As BSTRCollection
Limitations:

Read only.
See also: VCDCategoryMap, VCDCategoryMap.ItemsInCategory, BSTRCollection

<< VCDCategoryMap


VCDCategoryMap::ItemsInCategory

VCDCategoryMap.ItemsInCategory Property
Returns a collection with the names of the VCDPropertyItems objects in a specified category.
Syntax:
Public ItemsInCategory( Category As String ) As BSTRCollection

Parameter | Description
Category | The name of an existing item category. You can obtain a list of valid categories for the current device with the VCDCategoryMap.Categories property.
Limitations:

Read only.
See also: VCDCategoryMap, VCDCategoryMap.Categories, BSTRCollection

<< VCDCategoryMap


VCDMapStringsProperty

This class represents an interface to a value of a video capture device property, that uses names for the values.

Information

Introduced in IC Imaging Control 2.0

Inheritance

VCDPropertyInterface
VCDRangeProperty
VCDMapStringsProperty

Properties

Property | Description
String | Sets or gets the name current value of the property controlled through this interface.
Strings | Returns a list with the available strings this property can be set to.

<< Classes


VCDRangeProperty

This class represents a range interface to a value of a video capture device property.

Information

Introduced in IC Imaging Control 2.0

Inheritance

VCDPropertyInterface
VCDRangeProperty
VCDMapStringsProperty

Properties

Property | Description
Default | Returns the default value of the range.
Delta | Returns the length of the interval between the valid values in the range.
RangeMax | Returns the maximum value of the range.
RangeMin | Returns the minimum value of the range.
Value | Returns or sets the current value of the range.

<< Classes


VCDRangeProperty::Default

VCDRangeProperty.Default Property
Returns the default value of the range.
Syntax:
Public Default As Long
Limitations:

Run time only, read only.
See also: VCDRangeProperty, VCDRangeProperty.RangeMin, VCDRangeProperty.RangeMax

<< VCDRangeProperty


VCDRangeProperty::Delta

VCDRangeProperty.Delta Property
Returns the length of the interval between the valid values in the range.
Syntax:
Public Delta As Long
Limitations:

Run time only, read only.
See also: VCDRangeProperty

<< VCDRangeProperty


VCDRangeProperty::RangeMax

VCDRangeProperty.RangeMax Property
Returns the maximum value of the range.
Syntax:
Public RangeMax As Long
Limitations:

Run time only, read only.
See also: VCDRangeProperty, VCDRangeProperty.RangeMin, VCDRangeProperty.Default

<< VCDRangeProperty


VCDRangeProperty::RangeMin

VCDRangeProperty.RangeMin Property
Returns the minimum value of the range.
Syntax:
Public RangeMin As Long
Limitations:

Run time only, read only.
See also: VCDRangeProperty, VCDRangeProperty.RangeMax, VCDRangeProperty.Default

<< VCDRangeProperty


VCDRangeProperty::Value

VCDRangeProperty.Value Property
Returns or sets the current value of the range.
Syntax:
Public Value As Long
Limitations:

Run time only.
See also: VCDRangeProperty, VCDRangeProperty.RangeMin, VCDRangeProperty.RangeMax, VCDRangeProperty.Default, VCDRangeProperty.Delta

<< VCDRangeProperty


VCDMapStringsProperty::String

VCDMapStringsProperty.String Property
Sets or gets the name current value of the property controlled through this interface.
Syntax:
Public String As String
Limitations:

Run time only.
See also: VCDMapStringsProperty, VCDMapStringsProperty.Strings

<< VCDMapStringsProperty


VCDMapStringsProperty::Strings

VCDMapStringsProperty.Strings Property
Returns a list with the available strings this property can be set to.
Syntax:
Public Strings As BSTRCollection
Limitations:

Run time only, read only.
See also: VCDMapStringsProperty, VCDMapStringsProperty.String, BSTRCollection

<< VCDMapStringsProperty


VCDPropertyElement

This class represents an element of video capture device property.

Information

Introduced in IC Imaging Control 2.0

Properties

Property | Description
Count | Returns the number of interfaces this element exposes to access its data.
ElementID | Returns a string with the GUID of the element
Item | Returns one of this element's interfaces.
Name | Returns the display name of this element.
Parent | Returns the item this element belongs to.

Methods

Method | Description
FindInterface | Returns the desired interface to this element, if it exists.
Update | Updates the internal cache of the element to match the device's state.

<< Classes


VCDPropertyElement::Count

VCDPropertyElement.Count Property
Returns the number of interfaces this element exposes to access its data.
Syntax:
Public Count As Long
Limitations:

Run time only.
See also: VCDPropertyElement

<< VCDPropertyElement


VCDPropertyElement::ElementID

VCDPropertyElement.ElementID Property
Returns a string with the GUID of the element
Syntax:
Public ElementID As String
Limitations:

Run time only.
See also: VCDPropertyElement, Standard Element Identifier Strings

<< VCDPropertyElement


VCDPropertyElement::Item

VCDPropertyElement.Item Property
Returns one of this element's interfaces.
Syntax:
Public Item(Index As Long) As VCDPropertyInterface

Parameter | Description
Index | Specifies the index of the interface to return. The index must lie in the range [1, VCDPropertyElement.Count ], otherwise an error occurs.
Limitations:

Run time only.
See also: VCDPropertyElement, VCDPropertyElement.Count, VCDPropertyInterface

<< VCDPropertyElement


VCDPropertyElement::Name

VCDPropertyElement.Name Property
Returns the display name of this element.
Syntax:
Public Name As String
Limitations:

Run time only.
See also: VCDPropertyElement

<< VCDPropertyElement


VCDPropertyElement::Parent

VCDPropertyElement.Parent Property
Returns the item this element belongs to.
Syntax:
Public Parent As VCDPropertyItem
Limitations:

Run time only.
See also: VCDPropertyElement, VCDPropertyItem

<< VCDPropertyElement


VCDPropertyElement::FindInterface

VCDPropertyElement.FindInterface Method
Returns the desired interface to this element, if it exists.
Syntax:
Public Function FindInterface( InterfaceID As String ) As VCDPropertyInterface
Return Value:

The desired VCDPropertyInterface if it exists, otherwise an exception occurs.

See also: VCDPropertyElement, Standard Interface Identifier Strings

<< VCDPropertyElement


VCDPropertyElement::Update

VCDPropertyElement.Update Method
Updates the internal cache of the element to match the device's state.
Syntax:
Public Sub Update()
Remarks:

Some properties may be controlled externally at the device, while the element does not know about that. To prevent that inconsistency from happening, you can use this function to update the cache.

See also: VCDPropertyElement

<< VCDPropertyElement


VCDPropertyElements

This class is a collection of VCDPropertyElement objects.

Example

This example lists all VCDPropertyItems and VCDPropertyElements in the debug output window.

Dim PropertyItem As VCDPropertyItem
Dim PropertyElement As VCDPropertyElement

For Each PropertyItem In ICImagingControl1.VCDPropertyItems
     Debug.Print PropertyItem.Name
    For Each PropertyElement In PropertyItem.Elements
        Debug.Print "    " + PropertyElement.Name
    Next
Next

Information

Introduced in IC Imaging Control 2.0

Properties

Property | Description
Count | Returns the number of elements in the VCDPropertyElements collection.
Item | Returns the VCDPropertyElement at the specified position.

Methods

Method | Description
FindElement | Searches the collection for a VCDPropertyElement with a given element id.
FindInterface | This method returns the VCDPropertyInterface that is specified by the passed string.

<< Classes


VCDPropertyElements::Count

VCDPropertyElements.Count Property
Returns the number of elements in the VCDPropertyElements collection.
Syntax:
Public Count As Long
Limitations:

Read only.
See also: VCDPropertyElements, VCDPropertyElements.Item

<< VCDPropertyElements


VCDPropertyElements::Item

VCDPropertyElements.Item Property
Returns the VCDPropertyElement at the specified position.
Syntax:
Public Item(Index As Long) As VCDPropertyElement

Parameter | Description
Index | Specifies the index of the VCDPropertyElement to return. The index must lie in the range [1, VCDPropertyElements.Count ].
Limitations:

Read only.
See also: VCDPropertyElements, VCDPropertyElements.Count

<< VCDPropertyElements


VCDPropertyElements::FindElement

VCDPropertyElements.FindElement Method
Searches the collection for a VCDPropertyElement with a given element id.
Syntax:
Public Function FindElement( ElementID As String ) As VCDPropertyElement

Parameter | Description
ElementID | Specifies the element identifier string of the VCDPropertyElement to be returned.
Return Value:

If the collection contains an VCDPropertyElement with an element identifier string equal to the passed element identifier string, the FindElement method returns this VCDPropertyElement.

If the identifier string was not found, the function returns Nothing.

Remarks:

The element identifier strings are GUIDs. A list of strings can be found in Standard Element Identifier Strings list.

The Basic Use of VCD Properties article in the Programmer's Guide shows how to use the element identifier strings.

See also: VCDPropertyElements, VCDPropertyElement, Standard Element Identifier Strings, Basic Use of VCD Properties

<< VCDPropertyElements


VCDPropertyElements::FindInterface

VCDPropertyElements.FindInterface Method
This method returns the VCDPropertyInterface that is specified by the passed string.
Syntax:
Public Function FindInterface( InterfacePath As String ) As VCDPropertyInterface

Parameter | Description
InterfacePath | Specifies the path to the VCDPropertyInterface. The string contains an element identifier string and an interface identifier string. The identifier strings are separated by a colon: "element_id:interface_id".
Return Value:

If the VCDPropertyElements collection contains an VCDPropertyInterface with an interface identifier string equal to the passed interface identifier string, the FindInterface method returns this VCDPropertyInterface.

If the identifier string was not found, the function returns Nothing.

Remarks:

The interface identifier strings are GUIDs. A list of strings can be found in Standard Interface Identifier Strings list.

The Basic Use of VCD Properties article in the Programmer's Guide shows how to use the interface identifier strings.

See also: VCDPropertyElements, VCDPropertyElement, VCDPropertyInterface, Standard Element Identifier Strings, Standard Interface Identifier Strings, Basic Use of VCD Properties

<< VCDPropertyElements


VCDPropertyItem

A VCDPropertyItem object provides the functionality to access a video capture device property.

Usage

A VCDPropertyItem is retrieved from a VCDPropertyItems collection. It provides the properties's elements ( VCDPropertyElement ) like "range", "auto" etc. It also provides the property's name and identifier string.

A property item can contain one or more VCDPropertyElements. It may contains a VCDPropertyElement that provides the propertie's value and a second VCDPropertyElement that provides the automation switch.

Sample

The method VCDPropertyItems.FindItem is used to retrieve a VCDPropertyItem. The property to be retrieved is specified by an item identifier string. To retrieve the brightness property, the string VCDID_Brightness is used. The item identifier strings are defined in the module VCDPropertyID.bas.

' Get the Brightness property item
Dim Brightness As VCDPropertyItem
Set Brightness = ICImagingControl1.VCDPropertyItems.FindItem(VCDID_Brightness)

Information

Introduced in IC Imaging Control 2.0

Properties

Property | Description
Elements | The Elements property is a VCDPropertyElements collection contained in the current VCDPropertyItem.
ItemID | Returns a string that contains the GUID of the property item.
Name | Returns the display name of the property item.

Methods

Method | Description
Update | Updates the internal cache of the item to match the video capture device's current state.

<< Classes


VCDPropertyItem::Elements

VCDPropertyItem.Elements Property
The Elements property is a VCDPropertyElements collection contained in the current VCDPropertyItem.
Syntax:
Public Elements As VCDPropertyElements
Limitations:

Run time only, read only.
Remarks:

The Elements collection is used to retrieve all available VCDPropertyElements that are provided by the current VCDPropertyItem.

A property item can contain one or more VCDPropertyElements. It may contains a VCDPropertyElement that provides the propertie's value and a second VCDPropertyElement that provides the automation switch.

See also: VCDPropertyItem, VCDPropertyElement, VCDPropertyElements

<< VCDPropertyItem


VCDPropertyItem::ItemID

VCDPropertyItem.ItemID Property
Returns a string that contains the GUID of the property item.
Syntax:
Public ItemID As String
Limitations:

Run time only, read only.
See also: VCDPropertyItem, Standard Property Item Identifier Strings

<< VCDPropertyItem


VCDPropertyItem::Name

VCDPropertyItem.Name Property
Returns the display name of the property item.
Syntax:
Public Name As String
Limitations:

Run time only, read only.
Remarks:

The name of the property is the readable name like "Brightness", "Exposure" etc.

See also: VCDPropertyItem

<< VCDPropertyItem


VCDPropertyItem::Update

VCDPropertyItem.Update Method
Updates the internal cache of the item to match the video capture device's current state.
Syntax:
Public Sub Update
Remarks:

Some properties may be controlled externally at the video capture device while the element does not know about that. To prevent that inconsistency from happening, this function is used to update the property values of the property item.

See also: VCDPropertyItem

<< VCDPropertyItem


VCDPropertyItems

This class contains a collection of all VCDPropertyItem objects that are supported by the currently opened device.

The VCDPropertyItems class provides methods to search a VCDPropertyItem, VCDPropertyElement or VCDPropertyInterface. In addition, a VCDCategoryMap can be optained from the collection that maps the individual properties to categories.

Example

This samples demonstrates how to retrieve the property brightness from the VCDPropertyItems collection:

Dim Brightness As VCDPropertyItem
Set Brightness = ICImagingControl1.VCDPropertyItems.FindItem(VCDID_Brightness)

Information

Introduced in IC Imaging Control 2.0

Properties

Property | Description
CategoryMap | The CategoryMap property returns a VCDCategoryMap object.
Count | Returns the number of VCDPropertyItems supported by the current video capture device.
Item | Returns the VCDPropertyItem at the specified index.

Methods

Method | Description
FindElement | This method returns the VCDPropertyElement that is referred by the passed identifier string.
FindInterface | This method returns the VCDPropertyInterface that is referred by the passed identifier string.
FindItem | Returns the VCDPropertyItem that is referred by the passed identifier string.
Load | This method sets all property values to the values specified in the passed string.
Save | This method returns a string with the current values of all property items in this collection.
Supported | This method returns, whether the specified property item is supported by the current video capture device.
Update | Updates the property values of all VCDPropertyItems in this collection with the property values of the current video capture device.

<< Classes


VCDPropertyItems::CategoryMap

VCDPropertyItems.CategoryMap Property
The CategoryMap property returns a VCDCategoryMap object.
Syntax:
Public CategoryMap As VCDCategoryMap
Limitations:

Run time only, read only.
Remarks:

A VCDCategoryMap is used to sort VCDPropertyItems in categories like "Color","Image", "Exposure", "Special" etc.

See also: VCDPropertyItems, VCDCategoryMap

<< VCDPropertyItems


VCDPropertyItems::Count

VCDPropertyItems.Count Property
Returns the number of VCDPropertyItems supported by the current video capture device.
Syntax:
Public Count As Long
Limitations:

Run time only, read only.
Remarks:

The Count is used to retrieve the range of the index for the VCDPropertyItems.Item method.

See also: VCDPropertyItems, VCDPropertyItems.Item

<< VCDPropertyItems


VCDPropertyItems::Item

VCDPropertyItems.Item Property
Returns the VCDPropertyItem at the specified index.
Syntax:
Public Item(Index As Long) As VCDPropertyItem

Parameter | Description
Index | Specifies the index of the VCDPropertyItem to be returned. The range of the index starts at 1 and ends at VCDPropertyItems.Count. If the specified index is out of this range an exception is thrown.
Limitations:

Run time only, read only.
See also: VCDPropertyItems, VCDPropertyItems.Count

<< VCDPropertyItems


VCDPropertyItems::FindElement

VCDPropertyItems.FindElement Method
This method returns the VCDPropertyElement that is referred by the passed identifier string.
Syntax:
Public Function FindElement(ElementPath As String) As VCDPropertyElement

Parameter | Description
ElementPath | The element path string consists of an item identifier and an element identifier string. The identifier strings are separated by a colon: "item_id:element_id"
Return Value:

If the collection contains an item with an element matching the given element path, the FindElement method returns the VCDPropertyElement.

If the element path string was not found, the function returns Nothing.

Remarks:

For available property item identifier and element identifier strings see VCDPropertyIDs
See also: VCDPropertyItems, VCDPropertyItem, VCDPropertyElement, Standard Property Item Identifier Strings, Standard Element Identifier Strings

<< VCDPropertyItems


VCDPropertyItems::FindInterface

VCDPropertyItems.FindInterface Method
This method returns the VCDPropertyInterface that is referred by the passed identifier string.
Syntax:
Public Function FindInterface(InterfacePath As String) As VCDPropertyInterface

Parameter | Description
InterfacePath | The interface path string consists of an item identifier, an element identifier and an interface identifier string. The identifier strings are separated by a colon: "item_id:element_id:interface_id"
Return Value:

If the collection contains a property item with an interface matching the given interface path, the FindInterface method returns the VCDPropertyInterface.

If the identifier string was not found, the function returns Nothing.

Remarks:

For available property item identifier and element identifier strings see VCDPropertyIDs.

See also: VCDPropertyItems, VCDPropertyItem, VCDPropertyInterface, Standard Property Item Identifier Strings, Standard Element Identifier Strings, Standard Interface Identifier Strings

<< VCDPropertyItems


VCDPropertyItems::FindItem

VCDPropertyItems.FindItem Method
Returns the VCDPropertyItem that is referred by the passed identifier string.
Syntax:
Public Function FindItem(ItemIdentifier As String) As VCDPropertyItem

Parameter | Description
ItemIdentifier | Specifies the item identifier string.
Return Value:

If the identifier string was not found, the function returns Nothing.

Remarks:

For available property item identifier strings see Standard Property Item Identifier Strings. A sample can be found in the Basic Use of VCD Properties tutorial.

See also: VCDPropertyItems, VCDPropertyItem, Standard Property Item Identifier Strings, Basic Use of VCD Properties

<< VCDPropertyItems


VCDPropertyItems::Load

VCDPropertyItems.Load Method
This method sets all property values to the values specified in the passed string.
Syntax:
Public Sub Load(LoadString As String)

Parameter | Description
LoadString | A string containing property states in XML format.
Remarks:

The passed string is organized in an XML format. It contains the settings of properties of a video capture device. If the Load method is performed, all properties that are referred in this string are tried to be set to the values in this string. Properties that are not listed in the passed string keep unchanged. If properties are listed in the string that are not supported by the current video capture device, then they are ignored.

See also: VCDPropertyItems, VCDPropertyItems.Save

<< VCDPropertyItems


VCDPropertyItems::Save

VCDPropertyItems.Save Method
This method returns a string with the current values of all property items in this collection.
Syntax:
Public Function Save As String
Return Value:

The returned string contains the property values in XML format. It can be passed

Remarks:

The returned string can be saved to a file. It also can be passed to the VCDPropertyItems.Load method. This loads the current video capture device with predefined property values.

See also: VCDPropertyItems, VCDPropertyItems.Load

<< VCDPropertyItems


VCDPropertyItems::Supported

VCDPropertyItems.Supported Method
This method returns, whether the specified property item is supported by the current video capture device.
Syntax:
Public Function Supported(ItemIdentifier As String) As Boolean

Parameter | Description
ItemIdentifier | A string containing the identifier string of the property item.
Return Value:

The method returns True, if the property item specified by ItemIdentifier is supported by the current video capture device. If the property item is not supported, this method returns False.

Remarks:

For available identifier strings see Standard Property Item Identifier Strings.

See also: VCDPropertyItems, Standard Property Item Identifier Strings

<< VCDPropertyItems


VCDPropertyItems::Update

VCDPropertyItems.Update Method
Updates the property values of all VCDPropertyItems in this collection with the property values of the current video capture device.
Syntax:
Public Sub Update
Remarks:

Some properties may be controlled externally at the device, while the element does not know about that. To prevent that inconsistency from happening, this function can be called to update the cache.

See also: VCDPropertyItems, VCDPropertyItem

<< VCDPropertyItems


VCDSwitchProperty

This class represents a switch interface to a value of a video capture device property. A switch interface is used to enable or disable settings of a property.

Information

Introduced in IC Imaging Control 2.0

Inheritance

VCDPropertyInterface
VCDSwitchProperty

Properties

Property | Description
Switch | Returns or changes the state of the switch property.

<< Classes


VCDSwitchProperty::Switch

VCDSwitchProperty.Switch Property
Returns or changes the state of the switch property.
Syntax:
Public Switch As Boolean
Limitations:

Run time only.
See also: VCDSwitchProperty

<< VCDSwitchProperty


BSTRCollection

This class is a collection of strings.

Information

Introduced in IC Imaging Control 2.0

Properties

Property | Description
Count | Returns the count of strings in the collection.
Item | Returns the string at the specified position.

Methods

Method | Description
FindItem | Searches the collection for a given string.

<< Classes


BSTRCollection::Count

BSTRCollection.Count Property
Returns the count of strings in the collection.
Syntax:
Public Count As Long
Limitations:

Read only.
See also: BSTRCollection, BSTRCollection.Item, BSTRCollection.FindItem

<< BSTRCollection


BSTRCollection::Item

BSTRCollection.Item Property
Returns the string at the specified position.
Syntax:
Public Item(Index As Long) As String

Parameter | Description
Index | Specifies the index of the string to return. The index must lie in int the range [1, BSTRCollection.Count ], otherwise an error occurs.
Limitations:

Read only.
Example:

..

..
See also: BSTRCollection, BSTRCollection.Count, BSTRCollection.FindItem

<< BSTRCollection


BSTRCollection::FindItem

BSTRCollection.FindItem Method
Searches the collection for a given string.
Syntax:
Public Function FindItem(item As String) As Long

Parameter | Description
item | Specifies the string to look for.
Return Value:

If the collection contains a string equal to the given string, the FindItem method returns the index of this item in the collection. If the string is not found, the FindItem method returns -1.

See also: BSTRCollection, BSTRCollection.Count, BSTRCollection.Item

<< BSTRCollection


VCDSimpleProperty

This class wraps the concept of VCDProperties to make them easier to use.

Usage

Private VCDProp As VCDSimpleProperty

A sample that shows the usage of the VCDSimpleProperty class is documented in the Using the VCD Simple Property Class chapter.

Files

The VCDSimpleProperty class is located in the samples\vb6\Common directory of the IC Imaging Control installation directory.

To use the class in a project, the class file VCDSimpleProperty.cls and the implementation module VCDSimpleModule.bas must be added to the project by by selecting Project -> Add File... from the main menu.

Information

Source File: samples\vb6\Common\VCDSimpleProperty.cls
Introduced in IC Imaging Control 2.0

Properties

Property | Description
Automation | Returns or sets the automation of the property item with the specified id.
DefaultValue | Returns the default value of the specified property item.
RangeMax | Returns the maximum value of the specified property item.
RangeMin | Returns the minimum value of the specified property item.
RangeValue | Returns or sets the value of the property item with the specified id.

Methods

Method | Description
AutoAvailable | Returns whether automation for the specified property item is available.
Available | Checks whether the specified property item is supported by the current video capture device.
Init | Assign the current VCDPropertyItems collection to the VCDSimpleProperty object.
OnePush | Invokes the operation of the specified property item.

<< Helper Classes


VCDSimpleProperty::Automation

VCDSimpleProperty.Automation Property
Returns or sets the automation of the property item with the specified id.
Syntax:
Public Automation(id As String) As Boolean

Parameter | Description
id | ID of the VCDPropertyItem whose automation is to be set or get.
Limitations:

VCDSimpleProperty.Init has to be called before using this function.
Remarks:

hjlö

Sample:

jlkghsdf

See Also: VCDSimpleProperty, VCDSimpleProperty.AutoAvailable, VCDPropertyIDs

<< VCDSimpleProperty


VCDSimpleProperty::DefaultValue

VCDSimpleProperty.DefaultValue Property
Returns the default value of the specified property item.
Syntax:
Public DefaultValue(id As String) As Long

Parameter | Description
id | ID of the VCDPropertyItem whose default value is to be retrieved.
Limitations:

Read only, VCDSimpleProperty.Init has to be called before using this property.

See Also: VCDSimpleProperty, VCDPropertyIDs

<< VCDSimpleProperty


VCDSimpleProperty::RangeMax

VCDSimpleProperty.RangeMax Property
Returns the maximum value of the specified property item.
Syntax:
Public RangeMax(id As String) As Long

Parameter | Description
id | ID of the VCDPropertyItem whose maximum value is to be retrieved.
Limitations:

Read only, VCDSimpleProperty.Init has to be called before using this property.

See Also: VCDSimpleProperty, VCDPropertyIDs

<< VCDSimpleProperty


VCDSimpleProperty::RangeMin

VCDSimpleProperty.RangeMin Property
Returns the minimum value of the specified property item.
Syntax:
Public RangeMin(id As String) As Long

Parameter | Description
id | ID of the VCDPropertyItem whose minimum value is to be retrieved.
Limitations:

Read only, VCDSimpleProperty.Init has to be called before using this property.

See Also: VCDSimpleProperty, VCDPropertyIDs

<< VCDSimpleProperty


VCDSimpleProperty::RangeValue

VCDSimpleProperty.RangeValue Property
Returns or sets the value of the property item with the specified id.
Syntax:
Public RangeValue(id As String) As Long

Parameter | Description
id | ID of the VCDPropertyItem whose range value is to be set or get.
Limitations:

VCDSimpleProperty.Init has to be called before using this function.
Remarks:

jkl

Sample:

jlkghsdf

See Also: VCDSimpleProperty, VCDPropertyIDs

<< VCDSimpleProperty


VCDSimpleProperty::AutoAvailable

VCDSimpleProperty.AutoAvailable Method
Returns whether automation for the specified property item is available.
Syntax:
Public Function AutoAvailable(id As String) As Boolean

Parameter | Description
id | Identifier string of a VCDPropertyItem. A list of valid strings can be found in Standard Property Item Identifier Strings.
Return value:

True, if the VCDPropertyItem specified by id supports automation, otherwise False.

Limitations:

VCDSimpleProperty.Init has to be called before using this function
Sample:

For a sample see Using the VCD Simple Property Class.

See Also: VCDSimpleProperty, VCDSimpleProperty.Automation, Standard Property Item Identifier Strings

<< VCDSimpleProperty


VCDSimpleProperty::Available

VCDSimpleProperty.Available Method
Checks whether the specified property item is supported by the current video capture device.
Syntax:
Public Function Available(id As String) As Boolean

Parameter | Description
id | Identifier string of the VCDPropertyItem. A list of valid strings can be found in Standard Property Item Identifier Strings.
Return value:

True, if the VCDPropertyItem specified by id is available, otherwise False.

Limitations:

VCDSimpleProperty.Init has to be called before using this function.
Sample:

For a sample see Using the VCD Simple Property Class.

See Also: VCDSimpleProperty, VCDPropertyIDs, Standard Property Item Identifier Strings

<< VCDSimpleProperty


VCDSimpleProperty::Init

VCDSimpleProperty.Init Method
Assign the current VCDPropertyItems collection to the VCDSimpleProperty object.
Syntax:
Public Sub Init(Tree As VCDPropertyItems)

Parameter | Description
Tree | A VCDPropertyItems collection.
Remarks:

The init method must be called before the VCDSimpleProperty object can be used. If init was not called, every other call to methods of VCDSimpleProperty will fail.

Sample:

For a sample code, take a look at Using the VCD Simple Property Class.

See Also: VCDSimpleProperty, VCDPropertyItems, ICImagingControl.VCDPropertyItems, Using the VCD Simple Property Class

<< VCDSimpleProperty


VCDSimpleProperty::OnePush

VCDSimpleProperty.OnePush Method
Invokes the operation of the specified property item.
Syntax:
Public Sub OnePush(id As String)

Parameter | Description
id | ID of the VCDPropertyItem whose operation is to be invoked.
Limitations:

VCDSimpleProperty.Init has to be called before using this function.
See Also: VCDSimpleProperty, VCDPropertyIDs

<< VCDSimpleProperty


ICImagingControl::VCDPropertyItems

ICImagingControl.VCDPropertyItems Property
Returns a VCDPropertyItems collection representing the properties of the currently opened device.
Syntax:
Public VCDPropertyItems As VCDPropertyItems
Information:

Introduced in IC Imaging Control 2.0
See also: ICImagingControl, VCDPropertyItems

<< ICImagingControl


ICImagingControl::LivePause

ICImagingControl.LivePause Property
This property suspends and restarts the current delivery of images.
Syntax:
Public LivePause As Boolean
Limitations:

Runtime only
Remarks:

If LivePause is set to True, no images are delivered. This saves CPU load while no images are needed. The live video is restarted very fast, if LivePause is set to False again.

Information:

Introduced in IC Imaging Control 2.0
See also: ICImagingControl, ICImagingControl.LiveStart, ICImagingControl.LiveStop, ICImagingControl.LiveCapturePause

<< ICImagingControl


ICImagingControl::SaveDeviceState

ICImagingControl.SaveDeviceState Method
Saves the currently opened device and its settings to a string.
Syntax:
Public Function SaveDeviceState() As String
Return Value:

A string containing information about the opened device.

Limitations:

A valid device must be opened.
Remarks:

SaveDeviceState saves the following settings of ICImagingControl:

  • Opened Device and its serial number
  • Video norm
  • Video format
  • Input channel
  • Frame rate
  • Vertical Flip
  • Horizontal Flip
  • All VCDProperties

With ICImagingControl.LoadDeviceState, you can re-open the device with the saved settings.

Information:

Introduced in IC Imaging Control 2.0
Sample:

The following example saves the currently opened device to a file named "device.dat".

Dim deviceState As String
deviceState = ICImagingControl1.SaveDeviceState()
See also: ICImagingControl, ICImagingControl.LoadDeviceState

<< ICImagingControl


ICImagingControl::LoadDeviceState

ICImagingControl.LoadDeviceState Method
Restores the device settings saved with ICImagingControl.SaveDeviceState.
Syntax:
Public Sub LoadDeviceState( deviceStateString As String, OpenDevice As Boolean )

Parameter | Description
deviceStateString | A string containing device information created by ICImagingControl.SaveDeviceState.
OpenDevice | If this parameter is set to false, the method does not open a new device. if the device stored in the settings is different from the one that is already opened, an error is returned. Otherwise the settings are applied to the device. If this parameter is set to true, the method will open the device specified in the settings.
Information:

Introduced in IC Imaging Control 2.0
Sample:

The following example loads device settings from a string and starts live video:

Dim deviceStateString As String
' Assume the string contains data
ICImagingControl1.LoadDeviceState deviceStateString, false
ICImagingControl1.LiveStart
See also: ICImagingControl, ICImagingControl.SaveDeviceState

<< ICImagingControl


ICImagingControl::SaveDeviceStateToFile

ICImagingControl.SaveDeviceStateToFile Method
Saves the currently opened device and its settings to a file.
Syntax:
Public Sub SaveDeviceStateToFile( filename As String )

Parameter | Description
filename | The name of a device settings file to be (re-)created.
Limitations:

A valid device must be opened.
Remarks:

SaveDeviceStateToFile saves the following settings of IC Imaging Control:

  • Opened Device and its serial number
  • Video norm
  • Video format
  • Input channel
  • Frame rate
  • Vertical Flip
  • Horizontal Flip
  • All VCDProperties

With ICImagingControl.LoadDeviceStateFromFile, you can re-open the device with the saved settings.

Information:

Introduced in IC Imaging Control 2.0
Sample:

The following example saves the currently opened device to a file named "device.dat".

ICImagingControl1.SaveDeviceStateToFile "device.dat"
See also: ICImagingControl, ICImagingControl.LoadDeviceStateFromFile

<< ICImagingControl


ICImagingControl::LoadDeviceStateFromFile

ICImagingControl.LoadDeviceStateFromFile Method
Restores the device settings saved with ICImagingControl.SaveDeviceStateToFile.
Syntax:
Public Sub LoadDeviceStateFromFile( filename As String, OpenDevice As Boolean )

Parameter | Description
filename | A file containing device information created by ICImagingControl.SaveDeviceStateToFile.
OpenDevice | If this parameter is set to false, the method does not open a new device. if the device stored in the settings is different from the one that is already opened, an error is returned. Otherwise the settings are applied to the device. If this parameter is set to true, the method will open the device specified in the settings.
Information:

Introduced in IC Imaging Control 2.0
Sample:

The following example loads device settings from "device.dat" and starts live video:

ICImagingControl1.LoadDeviceStateFromFile "device.dat"
ICImagingControl1.LiveStart
See also: ICImagingControl, ICImagingControl.SaveDeviceStateToFile

<< ICImagingControl


ICImagingControl::DeviceCountOfFramesDropped

ICImagingControl.DeviceCountOfFramesDropped Property
Returns the number dropped frames.
Syntax:
Public DeviceCountOfFramesDropped As Long
Limitations:

Read only, live mode must be started.
Information:

Introduced in IC Imaging Control 2.0
See also: ICImagingControl, ICImagingControl.DeviceCountOfFramesNotDropped, ICImagingControl.LiveStart

<< ICImagingControl


ICImagingControl::DeviceCountOfFramesNotDropped

ICImagingControl.DeviceCountOfFramesNotDropped Property
Returns the number of frames that were not dropped.
Syntax:
Public DeviceCountOfFramesNotDropped As Long
Limitations:

Read only, live mode must be started before.
Information:

Introduced in IC Imaging Control 2.0
See also: ICImagingControl, ICImagingControl.DeviceCountOfFramesDropped, ICImagingControl.LiveStart

<< ICImagingControl


ICImagingControl::ShowDeviceSettingsDialog

ICImagingControl.ShowDeviceSettingsDialog Method
This method opens a video capture device selection dialog.
Syntax:
Public Sub ShowDeviceSettingsDialog()
Remarks:

The method ShowDeviceSettingsDialog opens the IC Imaging Control built-in device selection dialog. In the dialog the end user can select a video capture device and adjust it's video norm, video format and input channel. If supported, frame rate, vertical and horizontal flip property can also be set.

Information:

Introduced in IC Imaging Control 2.0
Sample:

This example demonstrates how to show the dialog and start live mode:

ICImagingControl1.ShowDeviceSettingsDialog
ICImagingControl1.LiveStart
See also: ICImagingControl, ICImagingControl.ShowPropertyDialog

<< ICImagingControl


ICImagingControl::ShowPropertyDialog

ICImagingControl.ShowPropertyDialog Method
This method opens a dialog to adjust all properties of the currently opened video capture device.
Syntax:
Public Sub ShowPropertyDialog()
Information:

Introduced in IC Imaging Control 2.0
Sample:

This example demonstrates how to show the dialog:

ICImagingControl1.ShowPropertyDialog
See also: ICImagingControl, ICImagingControl.ShowDeviceSettingsDialog

<< ICImagingControl


ICImagingControl::SignalDetectedAvailable

ICImagingControl.SignalDetectedAvailable Property
Returns whether the current video capture device supports signal detection on its input ports.
Syntax:
Public SignalDetectedAvailable As Boolean
Limitations:

Run time only, read only.

Remarks:

If SignalDetectedAvailable is True, SignalDetected returns whether a video signal is detected on the currently selected input channel of the open video capture device.

Information:

Introduced in IC Imaging Control 2.0
See also: ICImagingControl, ICImagingControl.SignalDetected

<< ICImagingControl


ICImagingControl::SignalDetected

ICImagingControl.SignalDetected Property
Returns whether a video signal is detected on the currently selected input channel of the selected video capture device.
Syntax:
Public SignalDetected As Boolean
Limitations:

Run time only, read only.
Remarks:

This availability of this property can be checked using ICImagingControl.SignalDetectedAvailable.

Information:

Introduced in IC Imaging Control 2.0
See also: ICImagingControl, ICImagingControl.SignalDetectedAvailable

<< ICImagingControl


ImageBuffer::SaveAsJpeg

ImageBuffer.SaveAsJpeg Method
Saves the contents of the buffer to a JPEG compressed file to disk.
Syntax:
Public Sub SaveAsJpeg(Filename As String, Quality As Long)

Parameter | Description
Filename | The name of the file to which the buffer is saved.
Quality | Desired image quality. Should be in the range between 0 and 100.
Information:

Introduced in IC Imaging Control 2.0
Sample:

This example shows how to save the contents of an ImageBuffer to a file called "test.jpg":

Private Sub cmdSaveJPEG_Click()
    Dim CurrentBuffer As Integer
    ICImagingControl1.MemorySnapImage
    CurrentBuffer = ICImagingControl1.ImageBuffers.CurrentIndex
    ICImagingControl1.ImageBuffers.Item(CurrentBuffer).SaveAsJpeg "Test.jpg", 90
End Sub
See also: ImageBuffer, ImageBuffer.SaveAsBitmap

<< ImageBuffer


ImageBuffer::SaveAsBitmap

ImageBuffer.SaveAsBitmap Method
Saves the contents of the buffer to a bitmap file on disk.
Syntax:
Public Sub SaveAsBitmap(Filename As String, colorformat As ICImagingControlColorFormats)

Parameter | Description
Filename | The name of the file to which the buffer is saved.
colorformat | The desired color format of the bitmap file.
Information:

Introduced in IC Imaging Control 2.0
Sample:

This example shows how to save the contents of an ImageBuffer as an 8-bit gray bitmap:

Dim Buf As ImageBuffer
Set Buf = ICImagingControl1.ImageBuffers.Item(1)
Buf.SaveAsBitmap "test.jpg", ICY8
See also: ImageBuffer, ImageBuffer.SaveAsJpeg

<< ImageBuffer


ImageBuffer::Lines

ImageBuffer.Lines Property
Returns the number of lines in this ImageBuffer.
Syntax:
Public Lines As Long
Limitations:

Read only.
Information:

Introduced in IC Imaging Control 2.0
See also: ImageBuffer, ImageBuffer.PixelPerLine

<< ImageBuffer


ImageBuffer::PixelPerLine

ImageBuffer.PixelPerLine Property
Returns the number of pixels in each line of this ImageBuffer.
Syntax:
Public PixelPerLine As Long
Limitations:

Read only.
Information:

Introduced in IC Imaging Control 2.0
See also: ImageBuffer, ImageBuffer.Lines

<< ImageBuffer


ImageBuffer::ImageDataPtr

ImageBuffer.ImageDataPtr Property
Returns the address of the first byte of the image data.
Syntax:
Public ImageDataPtr As Long
Limitations:

Read only.
Remarks:

Please note that the images are stored bottom up, therefore the byte at the address, returned by this property, is the first byte of the first pixel of the last line of the image.

Information:

Introduced in IC Imaging Control 2.0
See also: ImageBuffer

<< ImageBuffer


OverlayBitmap::DrawFrameRect

OverlayBitmap.DrawFrameRect Method
This method draws an empty frame rectangle on the live video.
Syntax:
Public Sub DrawFrameRect( color As Long, startcolumn As Long, startrow As Long, endcolumn As Long, endrow As Long)

Parameter | Description
color, clr | Specifies the color of the frame.
startcolumn, XStart | Specifies the column in pixel units of the upper left hand corner of the rectangle on the live video.
startrow, YStart | Specifies the row in pixel units of the upper left hand corner of the rectangle on the live video.
endcolumn, XEnd | Specifies the column in pixel of the lower right hand corner of the rectangle on the live video.
endrow, YEnd | Specifies the row in pixel units of the lower right hand corner of the rectangle on the live video.
Limitations:

Run time only. Only after ICImagingControl.LiveStart has been called once.
Information:

Introduced in IC Imaging Control 2.0
Example:

This example demonstrates how to draw a red frame on the live video.

Dim ob As OverlayBitmap
Set ob = ICImagingControl1.OverlayBitmap
ob.DrawFrameRect RGB(255, 0, 0), 10,10, 10, 250
See also: OverlayBitmap, OverlayBitmap.DrawSolidRect, ICImagingControl.LiveStart

<< ICImagingControl.OverlayBitmap


OverlayBitmap::DrawFrameEllipse

OverlayBitmap.DrawFrameEllipse Method
This method draws an empty frame ellipse on the live video.
Syntax:

Public Sub DrawFrameEllipse( color As Long, x0 As Long, y0 As Long, x1 As Long, y1 As Long )

Parameter | Description
clr | Specifies the color of the ellipse.
x0 | Specifies the column in pixel units of the upper left hand corner of the bounding rectangle of the ellipse on the live video.
y0 | Specifies the row in pixel units of the upper left hand corner of the bounding rectangle of the ellipse on the live video.
x1 | Specifies the column in pixel units of the lower right hand corner of the bounding rectangle of the ellipse on the live video.
y1 | Specifies the row in pixel units of the lower right hand corner of the bounding rectangle of the ellipse on the live video.
Limitations:

Run time only. Only after ICImagingControl.LiveStart has been called once.
Information:

Introduced in IC Imaging Control 2.0
Example:

This example demonstrates how to draw a empty yellow ellipse on the live video.

See also: OverlayBitmap, OverlayBitmap.DrawSolidEllipse, ICImagingControl.LiveStart

<< ICImagingControl.OverlayBitmap


OverlayBitmap::DrawSolidRect

OverlayBitmap.DrawSolidRect Method
This method draws a solid, filled rectangle on the live video.
Syntax:
Public Sub DrawSolidRect( color As Long, startcolumn As Long, startrow As Long, endcolumn As Long, endrow As Long)

Parameter | Description
color, clr | Specifies the color of the rectangle.
startcolumn, XStart | Specifies the column in pixel units of the upper left hand corner of the rectangle on the live video.
startrow, YStart | Specifies the row in pixel units of the upper left hand corner of the rectangle on the live video.
endcolumn, XEnd | Specifies the column in pixel of the lower right hand corner of the rectangle on the live video.
endrow, YEnd | Specifies the row in pixel units of the lower right hand corner of the rectangle on the live video.
Limitations:

Run time only. Only after ICImagingControl.LiveStart has been called once.
Example:

This example demonstrates how to draw a red rectangle on the live video.

Dim ob As OverlayBitmap
Set ob = ICImagingControl1.OverlayBitmap
ob.DrawSolidRect RGB(255, 0, 0), 10,10, 10, 250
See also: OverlayBitmap, OverlayBitmap.DrawFrameRect, ICImagingControl.LiveStart

<< ICImagingControl.OverlayBitmap


Programmer's Guide

Perform your first steps with IC Imaging Control.

First Steps in Visual Basic 6

This chapter shows you how to get started with IC Imaging Control. With just a few mouse clicks and one line of code, you will be able to display a live video image in your Visual Basic program.

Grabbing an Image

This chapter shows you how to grab a still image from the video stream and save it to a .BMP file.

Adjust Image Settings

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

Capturing an AVI File

This chapter shows you how to save a video stream as a compressed AVI file.

Saving Codec Properties

This chapter shows you how to handle codecs and how to save and load the properties of a codec.

Controlling DV Devices

This sample shows you how to control the external transport features of your DV device from IC Imaging Control. External Transport means starting, stopping, winding etc. of the tape in the DV device.

Making Device Settings

This chapter shows you how to create a custom device settings dialog. The code is provided in reusable form, thus it can be easily integrated into your own applications.

Building an Application

This sample program shows you how to use all the building blocks from the previous chapters to create a real program.

Performing Image Processing

This chapter shows you how to create your own image processing functions.

Using Multiple Buffers

In the previous chapters, IC Imaging Control appeared to work with only one image buffer. In fact, IC Imaging Control uses multiple buffers to store image data. This chapter describes how multiple buffers are organized inside IC Imaging Control and in which way a program can access these buffers. Internally, IC Imaging Control uses a ring buffer to store image data. The next section will describe the idea behind the ring buffer concept.

Displaying Buffers on the ImageAvailable Event

This chapter shows how to control the display of image buffers using the ImageAvailable event.

Accessing an Image Buffer

This example shows the how to handle image buffers.

Performing Advanced Image Processing

This chapter illustrates how to perform sophisticated image processing.

Creating an Overlay

This chapter shows you how to write text and draw graphics on the live video images.

Scroll and Zoom

This chapter shows you how to use the scroll and zoom capabilities of IC Imaging Control.

Basic Use of VCD Properties

This chapter illustrates the basic functionality of the VCDProperties. It shows you how to retrieve interfaces which allow you to manipulate elements, such as the value or the automation state of a property.

List VCD Properties

This chapter shows you how to retrieve all properties of a video capture device using the new VCD property interface.

Using the VCD Simple Property Class

Up to the version 1.41 of IC Imaging Control, the properties of a device could be accessed using the properties %%Auto, %%AutoAvailable, %%Available, %%Default and %%Range. These properties have been depreciated as of version 2.0. The new VCD properties allow more detailed and generic access to the device's properties but require a little more code to be written. If you are happy with the old properties, a new helper class is introduced in version 2.0 that provides access methods to the VCD properties, which are similar to the old way. This chapter shows you how to use this helper class.

Capturing a Video File

This chapter shows you how to save a video stream as a compressed video file. In contrast to the Capturing an AVI File example, the MediaStreamSink is used to allow several video file formats to be recorded.

Filter Inspector

This example demonstrates how to use frame filters to perform basic image processing.

<< IC Imaging Control ActiveX User's Guide


First Steps in Visual Basic 6

This chapter shows you how to get started with IC Imaging Control. With just a few mouse clicks and one line of code, you will be able to display a live video image in your Visual Basic program.

Creating the Project

Assuming that you have already run the IC Imaging Control installation program and started Visual Basic, the next step is to create a project. To do this begin by selecting the 'New Project' command from the file menu, and select 'Standard EXE' as your project type. Then use the 'Project / Components...' command to include the file 'ICImagingControl 3.0' into the new project. You will see IC Imaging Control icon appear at the bottom of the toolbox.

Creating the Control

Click on the IC Imaging Control icon and draw it on the form. A white rectangle should appear on the form, and the Visual Basic Project window form on the right should display IC Imaging Control's properties.

Selecting a Video Source

In the properties window, click on the Device property. It will display all video sources that are installed on your computer in a combo box. Select the one you wish to use:

Selecting an Input Channel

In the project window, click on the InputChannel property. All the inputs that your video device processes, will be displayed. Some devices will display "n/a" as a property value, meaning that you do not need to select an input for this device. If input channels are displayed, select the one you wish to use. Note that the actual values displayed may vary depending on the selected device:

Selecting a Video Norm

This setting is only required, if you connect an analog camera via a video-to-1394 converter or frame grabber. Click on the VideoNorm property and select NTSC or PAL, depending on the video norm your camera supports. Again "n/a" is displayed, if there is no video norm to be selected:

Selecting a Video Format

The video format determines the video stream's image size and color depth. Select one in the VideoFormat box:

Adding Program Code

Now the single line of code mentioned earlier: In the FormLoad event, add this line of code, which will automatically enable the live video display when the program is started.

Private Sub Form_Load()
    ICImagingControl1.LiveStart
End Sub

Running the Program

Finished. You are now ready to hit F5 and watch your program display a live video.

<< Programmer's Guide


Grabbing an Image

This chapter shows you how to grab a still image from the video stream and save it to a .BMP file.

The source code for this sample program can be found in the samples\VB6\Grabbing an Image 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 First Steps in Visual Basic 6 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 having first make a selection, the program displays an error message and terminates.

Now add 3 buttons to the form and label them Start Live, Stop Live and Save Bitmap. Name the buttons cmdStartLive, cmdStopLive and cmdSaveBitmap respectively.

Add calls to IC Imaging Control's LiveStart and LiveStop methods:

Private Sub cmdStartLive_Click()
    ICImagingControl1.LiveStart

    ' Store in VideoHasStarted whether a video stream
    ' has been started once. If VideoHasStarted is True,
    ' you can be sure that there is an image that can be saved.
    VideoHasStarted = True

End Sub

Private Sub cmdStopLive_Click()
    ICImagingControl1.LiveStop
End Sub

Run the program. You can now start and stop the live image by clicking on the respective buttons.

The video format determines the video stream's image size and color depth. Select one in the VideoFormat box:

When the live video is running, a call to the method MemorySnapImage Method will grab the currently displayed image and stores it in IC Imaging Control's image buffer. On the other hand, when you stop the live image, the last frame of the live image is stored automatically in IC Imaging Control's image buffer for further display. In both cases, we can save the currently displayed image by calling the MemorySaveImage method. We only need to add a little error handling and a common dialog box so that we can select a filename. Drag a Common Dialog Box to your form and put this code in the Save Bitmap button's Click event:

Private Sub cmdSaveBitmap_Click()
    On Error GoTo cmdSaveBitmap_Click

    ' Check whether the video stream has been started once.
    ' If it has been started once, there are two possible situations:
    ' 1) The live video is running. In this case we grab the current frame
    '       in order to save it.
    ' 2) The live video has been stopped. In this case the last frame of the
    '       live video was grabbed automatically and we can save it now.

    If VideoHasStarted = True Then
        If ICImagingControl1.LiveVideoRunning Then
            ' The live video is running. Therefore, we need to grab the
            ' current frame.
            ICImagingControl1.MemorySnapImage
        End If

        With CommonDialog1
            .Filter = "Bitmap (*.bmp)|*.bmp|"
            .CancelError = True
            .ShowSave
            ICImagingControl1.MemorySaveImage .FileName
        End With

    Else
        MsgBox "Please click the Start Live button first!"
    End If

    Exit Sub

cmdSaveBitmap_Click:
    If Err <> cdlCancel Then MsgBox Err.Description
End Sub

Now you can start the live image to adjust your cameras brightness and focus, and then stop the live display and save the captured image.

<< Programmer's Guide


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
        ICImagingControl1.ShowDeviceSettingsDialog

        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)
        ICImagingControl1.LiveStart
    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


Capturing an AVI File

This chapter shows you how to save a video stream as a compressed AVI file.

To see how to save video streams in different file formats, see the Capturing a Video File example.

The source code for this sample program can be found in the samples\VB6\Capturing an AVI File 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 capture 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 having first made a selection, the program will display an error message and terminate.

Now add 3 buttons to the form and label them Start Live, Stop Live and Capture AVI. Name the buttons cmdStartLive, cmdStopLive and cmdCaptureVideo respectively.

Add calls to IC Imaging Control's LiveStart and LiveStop methods:

Private Sub cmdStartLive_Click()
    ICImagingControl1.LiveStart
End Sub

Private Sub cmdStopLive_Click()
    ICImagingControl1.LiveStop
End Sub

Run the program. You can now start and stop the live image by clicking on the respective buttons. This does not yet create an AVI file, but is required to create a preview for the live video stream. This is usually required to set up the camera before actually starting to record.

The AVI Recording Dialog

Now add another form to your project. Name it frmWriteAVI. Add a combo box for the available video codecs, a text box for the AVI filename, and buttons to start and stop AVI capture. (You may want to load the sample project instead of creating the form manually).

In the FormLoad event, the selection list is filled with the names of all video codecs installed on your computer. These can be used as an AVI compressor.

Private Sub Form_Load()
    Dim Codec As AviCompressor

    ' Fill the combobox "cboVideoCodec" with the available
    ' avi compressors (codecs).
    For Each Codec In ImagingControl.AviCompressors
        cboVideoCodec.AddItem Codec.Name
    Next
    cboVideoCodec.ListIndex = 0
    If ImagingControl.LiveCapturePause = True Then
        chkPause.Value = 1
    Else
        chkPause.Value = 0
    End If

End Sub

The Click event of the Start Capture button calls IC Imaging Control's AviStartCapture method, with the filename and the name of the video codec as a parameter. There is also some code to disable the Close button and enable the Stop Capture button and to check whether the user has selected a codec and a filename:

Private Sub cmdStartCapture_Click()
    If cboVideoCodec.Text = "" Then
        MsgBox "Please select a video codec first.", vbExclamation + vbOKOnly
    ElseIf txtFilename.Text = "" Then
        MsgBox "Please select an AVI filename first.", vbExclamation + vbOKOnly
    End If

    If cboVideoCodec.Text <> "" And txtFilename.Text <> "" Then
        ImagingControl.AviStartCapture txtFilename, cboVideoCodec.Text
        cmdStartCapture.Enabled = False
        cmdStopCapture.Enabled = True
        cmdClose.Enabled = False
    End If
End Sub

The Pause button is a check box with a graphical style. It is used to set and reset the LiveCapturePause property of IC Imaging Control. If the LiveCapturePause property is set to True, AVI capture is paused. This means, that only the sink path of the image stream is paused. The live video is still displayed, but the video is not saved to the video file. If the LiveCapturePause property is set to False, IC Imaging Control immediately continues AVI capture. A previously started AVI file will be continued.

Private Sub chkPause_Click()
    If chkPause.Value = 1 Then
        ImagingControl.LiveCapturePause = True
    Else
        ImagingControl.LiveCapturePause = False
    End If
End Sub

The AVI capture can be started by a call to AviStartCapture, even if the LiveCapturePause property is set to True. In this case, the image stream is initialized and started and the live video is displayed. The images are not saved to the AVI file because the sink path is paused. As soon as the LiveCapturePause property is set to False, the sink path is started and images are written to the AVI file. The advantage of this is that the AVI capturing can be started, paused and restarted immediately on an event.

Finished. You can now run the program, select a codec, and create an AVI file. Note that compressing a video stream is a highly CPU intensive operation and not all codecs will be able to work at full image resolution and full frame rate.

<< Programmer's Guide


Saving Codec Properties

This chapter shows you how to handle codecs and how to save and load the properties of a codec.

Introduction

The source code for this example is contained in the samples\VB6\Saving Codec Properties sample source directory.

A codec compresses and decompresses video streams. Sometimes, a codec is also referred to as a "compressor" or an "avicompressor".

The properties of some (but not all) codecs can be retrieved and assigned with IC Imaging Control. For example, the quality of a video stream may be set before it is saved.

Codec properties are supplied as a binary data stream. It is very important to know the length of the data stream, as later when an application loads the data stream, it is required to allocate memory for it.

The saving file format must be binary, because the data stream is also binary.

You should not alter the binary data stream from a codec. Doing so would make the data no longer fit the codec, thus causing unpredictable errors. Furthermore, the codec properties of one codec will not match each other. IC Imaging Control prevents this situation from happening at all - it causes an error message.

A codec is an external DLL file that is handled by an AviCompressor object. If an AviCompressor object becomes invalid, the DLL will be removed from memory. In this case, most codecs will loose their previously set properties. You should, therefore, declare a global AviCompressor object in your form in order to avoid loosing properties.

You can retrieve data from or assign data to codecs where the property PropertyPageAvailable is True. It is therefore necessary to check this property before performing an operation.

Setting up the Project

Create a new project and add IC Imaging Control to the form. Now add 3 buttons to the form and label them Save Data, Load Data and Show Property Page. Name the buttons cmdSaveData, cmdLoadData and cmdShowPropertyPage respectively. Add at least one combo box to the form and name it cboVideoCodec. This combo box will contain the names of the codecs.

Setting Up the Codec

First of all, an application needs a global AviCompressor object that contains the data of the codec. This must be global, because the AviCompressor 's properties will be lost when it is removed from memory. So add the following line to the beginning of the form:

Dim Codec As AviCompressor

Add a Form_Load event procedure to the form and enter the following code to fill the combo box with the available codecs:

Private Sub Form_Load()

    ' Show available video codecs in the combo box
    For Each Codec In ICImagingControl1.AviCompressors
        cboVideoCodec.AddItem Codec.Name
    Next
    cboVideoCodec.ListIndex = 0

    ' Get the first available codec from ICImagingControl.
    Set Codec = ICImagingControl1.AviCompressors.Item(cboVideoCodec.ListIndex + 1)

    ' Enable or disable the buttons.
    cmdShowPropertyPage.Enabled = Codec.PropertyPageAvailable
    cmdLoadData.Enabled = Codec.PropertyPageAvailable
    cmdSaveData.Enabled = Codec.PropertyPageAvailable
End Sub

This code uses the AviCompressors property of IC Imaging Control to generate a list of all available codecs. As you can see, the global variable Codec is used as item in the For Each .. In .. statement. The first available codec will be assigned to the global AviCompressor object Codec. The three buttons will be enabled or disabled according to the property PropertyPageAvailable in the AviCompressor object. This avoids performing operations that are not supported by the codec.

Now add the Click event procedure of the combo box cboVideoCodec to your form:

Private Sub cboVideoCodec_Click()

    ' Get the codec object from ICImagingControl that is
    ' selected in the combobox.
    Set Codec = ICImagingControl1.AviCompressors.Item _
                         (cboVideoCodec.ListIndex + 1)

    ' Enable or disable the buttons.
    cmdShowPropertyPage.Enabled = Codec.PropertyPageAvailable
    cmdLoadData.Enabled = Codec.PropertyPageAvailable
    cmdSaveData.Enabled = Codec.PropertyPageAvailable
End Sub

The selection index of the combo box refers to an item in the AviCompressors collection. This item is assigned to the global AviCompressor object Codec.

The AviCompressor 's property PropertyPageAvailable is used to disable or enable the buttons. This prevents, for example, the user from pressing the cmdShowPropertyPage button when no property dialog is available for the codec.

Now, add the Click event procedure of the cmdShowPropertyPage button to your form:

Private Sub cmdShowPropertyPage_Click()

    ' Show the property dialog of the codec.
    Codec.ShowPropertyPage
End Sub

This shows the property dialog of the codec. The cmdShowPropertyPage button was enabled or disabled in the Form_Load and cboVideoCodec Click event procedure, thus you do not need to check PropertyPageAvailable again.

This shows the property dialog of the codec. The cmdShowPropertyPage button was enabled or disabled in the Form_Load and SelectedValueChanged event procedure, thus you do not need to check PropertyPageAvailable again.

Saving the Codec Properties

As described above, the codec properties are supplied as a binary data stream. A binary data stream is simply a list of bytes. It is recommended to save the byte count in the data stream as the first element in the file. Using this first element, when the data is loaded from file, a dynamic array can be sized or resized to the matching byte count in order to accommodate the data.

Add the Click event procedure of cmdSaveData to your form:

Private Sub cmdSaveData_Click()
    Dim Data() As Byte ' Dynamic array for the data stream.

    Open "test.bin" For Binary As #1 ' Must be opened binary!

    ' Save the length of the codec's name.
    Put #1, , Len(Codec.Name)

    ' Save the name of the codec.
    Put #1, , Codec.Name

    ' Save the byte count of the data stream. It is used
    ' when data is loaded from file to resize the dynamic array.
    Put #1, , Codec.CompressorDataSize

    ' Get the data from the codec.
    Data = Codec.CompressorData

    ' Save the data to the file.
    Put #1, , Data
    Close #1
End Sub

The codec properties will be saved in the file test.bin. Remember that the cmdSaveData button is only enabled, if AviCompressor.PropertyPageAvailable returns True. Alternatively, you can implement the following lines of code:

If Codec.PropertyPageAvailable Then
    ' Do something like saving etc.
Else
    MsgBox "This codec does not support properties!"
End If

Loading the Codec Properties

Add the Click event procedure of cmdLoadData to your form:

Private Sub cmdLoadData_Click()
    Dim Data() As Byte      ' Dynamic array for the data stream.
    Dim Length As Long      ' Length of the data stream.
    Dim NameLength As Long  ' Length of the codec's name.
    Dim CodecName As String ' Name of the codec.
    Dim i As Integer

    Open "test.bin" For Binary As #1 ' Must be opened binary!

    ' Read the length of the codec's name.
    Get #1, , NameLength

    ' Allocate memory for the name.
    CodecName = String(NameLength, " ")

    ' Read the name of the codec.
    Get #1, , CodecName

    ' Compare the names.
    If CodecName = Codec.Name Then
        ' Read the length of the follwing data.
        Get #1, , Length

        ' Resize the data array to Length.
        ReDim Data(Length)

        ' Read the codec data from the file.
        Get #1, , Data

        ' Assign the read data to the codec object.
        Codec.CompressorData = Data
    Else
        MsgBox "The saved data does not match to the used codec." + Chr(13) + _
               "saved: " + CodecName + Chr(13) + _
               "used: " + Codec.Name
    End If
    Close #1
End Sub

As described above at the cmdSaveData button, the cmdLoadData button is only enabled if AviCompressor.PropertyPageAvailable returns True. Before assigning data to a codec, you should check whether it supports properties:

If Codec.PropertyPageAvailable Then
    ' Do something like loading etc.
Else
    MsgBox "This codec does not support properties!"
End If

Using the Codec for Capture

For the sake of completeness, we have included the following statement that shows how to use the codec to capture an AVI file:

ImagingControl.AviStartCapture "test.avi", Codec.Name

This is not included in the example.

<< Programmer's Guide


Controlling DV Devices

This sample shows you how to control the external transport features of your DV device from IC Imaging Control. External Transport means starting, stopping, winding etc. of the tape in the DV device.

Setting up the Project

The source code for this sample program can be found in the samples\VB6\Controlling DV Devices sample source 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 First Steps in Visual Basic 6 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 having made a selection, the program will display an error message and terminate.

Now, add 2 buttons to the form and label them Start and Stop. Name the buttons cmdStart and cmdStop respectively.

Add calls to IC Imaging Control's LiveStart and LiveStop methods:

Private Sub cmdStart_Click()
    ICImagingControl1.LiveStart
    If ICImagingControl1.ExternalTransportAvailable = True Then
        cmdETPlay_Click
    End If
End Sub

Private Sub cmdStop_Click()
    ICImagingControl1.LiveStop
End Sub

The sub cmdStart_Click contains additional code to advise the DV device to start playing after the Start button has been clicked. If this additional code is missing, you could click the start button, but IC Imaging Control would stay empty, until the external transport mode has been set to "play".

Now, add four new buttons to the form and label them Play, Stop, Rewind and FF. Name the buttons cmdETPlay, cmdETStop, cmdETRewind and cmdETFastForward respectively. These four new buttons are used to set the external transport mode.

Add the click events for the new buttons. Each of the four new buttons sets an external transport mode for IC Imaging Control.

Private Sub cmdETPlay_Click()
    ICImagingControl1.ExternalTransportMode = ET_MODE_PLAY
End Sub

Private Sub cmdETStop_Click()
    ICImagingControl1.ExternalTransportMode = ET_MODE_STOP
End Sub

Private Sub cmdEtRewind_Click()
    ICImagingControl1.ExternalTransportMode = ET_MODE_REWIND
End Sub

Private Sub cmdETFastForward_Click()
    ICImagingControl1.ExternalTransportMode = ET_MODE_FASTFORWARD
End Sub

At least, the Form_Load event should check, whether the current video capture device supports external transport. If the device supports external transport, the four buttons, that are used to set the external transport mode, should be enabled.

Private Sub Form_Load()
    cmdETPlay.Enabled = False
    cmdETStop.Enabled = False
    cmdETFastForward.Enabled = False
    cmdETRewind.Enabled = False
    cmdStart.Enabled = False
    cmdStop.Enabled = False

    If Not ICImagingControl1.DeviceValid Then
        ICImagingControl1.ShowDeviceSettingsDialog

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

    cmdStart.Enabled = True
    cmdStop.Enabled = True

    ' Check whether external transport is available.
    If ICImagingControl1.ExternalTransportAvailable = True Then
        cmdETPlay.Enabled = True
        cmdETStop.Enabled = True
        cmdETFastForward.Enabled = True
        cmdETRewind.Enabled = True
    End If
End Sub

Calling IC Imaging Control's LiveStart method starts the image stream to capture images from the DV device. If the DV device has not got the "Play" command, no images are delivered from the DV device to IC Imaging Control. Thus, in order to get a live image from a DV device, LiveStart has to be called and then the transport mode has to be set to "Play":

ICImagingControl1.LiveStart
ICImagingControl1.ExternalTransportMode = ET_MODE_PLAY

<< Programmer's Guide


Making Device Settings

This chapter shows you how to create a custom device settings dialog. The code is provided in reusable form, thus it can be easily integrated into your own applications.

IC Imaging Control also offers a built-in dialog, which can be used to select and set up a device. If, however, the dialog provided by IC Imaging Control does not fit your needs, this chapter shows you how to create a custom dialog. It will first show you how to integrate the sample code into your own projects and then how to actually build the dialog.

Integrating the sample code into your project

The sample code for this example can be found in the samples\VB6\Making Device Settings directory. To integrate the code into your project, you just have to add the file frmDeviceSettings.frm. Select Project from the menu and then select Add Form. In the Add Form dialog click on the Existing tab. Now browse to the sample folder and open the file frmDeviceSettings.frm.

To call the dialog from your application, just 2 lines of code are needed. First, the ICImagingControl instance that you are using in your application (here: ICImagingControl1 ) must be assigned to the dialog. Then the dialog has to be called. To do this, just insert the following lines at an appropriate place into your code.

Set frmDeviceSettings.ImagingControl = ICImagingControl1
frmDeviceSettings.Show vbModal

Creating the Dialog

In this chapter, we will focus on the device settings dialog. In addition to the dialog, you will of course need an application that calls it. The sample code of this chapter contains a ready-to-run project with a small application that calls the dialog.

Assuming you have already set up a main project, you now have to add a new form to the project. This form will contain the elements of the custom dialog. To add a new form, select Project from the menu and then choose Add Form. Choose the Dialog type of form. Name the form frmDeviceSettings.

Now add 5 combo boxes to the form. Name them cboDevice, cboVideoNorm, cboVideoFormat, cboFrameRate and cboInputChannel. Also add a text box, called txtSerial and two check boxes named chkFlipV and chkFlipH.

In addition to the controls mentioned above, the sample dialog also contains a label named lblErrorMessage. The Visible property of this label is set to false, so that it will not be displayed when the dialog is called. The reason for this is explained when the Form_Load event is discussed.

Adding Functionality to the Dialog

First, we need a global data structure that will store the state of the device. This is necessary since that state has to be restored, if the user clicks the Cancel button of the dialog. For this sample, the data structure looks as follows:

Private Type Settings
    DeviceAvail As Boolean
    Device As String

    VideoNormAvail As Boolean
    VideoNorm As String

    VideoFormat As String

    FrameRateAvail As Boolean
    FrameRate As Double

    InputChannelAvail As Boolean
    InputChannel As String

    FlipVAvail As Boolean
    FlipV As Boolean

    FlipHAvail As Boolean
    FlipH As Boolean
End Type

Now add some global variables:

Public ImagingControl As ICImagingControl
Private DeviceState As Settings
Const NOT_AVAILABLE = "n/a"

ImagingControl must be public since it is assigned from the main program before the dialog is called.

Now add a Form_Load event and insert the following code:

Private Sub Form_Load()
    If ImagingControl.DeviceValid Then
        If ImagingControl.LiveVideoRunning Then
            lblDevice.Visible = False
            lblVideoNorm.Visible = False
            lblVideoFormat.Visible = False
            lblFrameRate.Visible = False
            lblInputChannel.Visible = False
            lblSerial.Visible = False
            cboDevice.Visible = False
            cboVideoNorm.Visible = False
            cboVideoFormat.Visible = False
            cboFrameRate.Visible = False
            cboInputChannel.Visible = False
            txtSerial.Visible = False
            chkFlipV.Visible = False
            chkFlipH.Visible = False
            CancelButton.Visible = False

            Me.Caption = "Error"
            Me.Width = 3465
            Me.Height = 2175

            OKButton.Top = 85
            OKButton.Left = 134

            lblErrorMessage.Caption = "The device settings dialog is not available while the live video is running." _
                                    & vbCrLf & vbCrLf & "Stop the live video first."
            lblErrorMessage.Visible = True
            Exit Sub
        End If
    End If

    SaveDeviceSettings

    UpdateDevices
End Sub

The Form_Load event checks, whether the live video is running. If it is, it reformats the dialog box to display a message to tell you that the dialog will not be displayed, while the live video is running. This behavior was implemented to point out that changing the device will cause side effects. The ring buffer collection ICImagingControl.ImageBuffers is reset when the device is changed. Therefore, image data in the collection is lost.

Now add the click events of the OK and the Cancel button and insert the following code accordingly:

Private Sub OKButton_Click()
    Unload Me
End Sub

Private Sub CancelButton_Click()
    RestoreDeviceSettings

    Unload Me
End Sub

As can be seen above, the Form_Load event calls a procedure SaveDeviceSettings and the CancelButton_Click event calls RestoreDeviceSettings. These are two helper procedures that fill and read out the global data structure DeviceState to save\restore the state of the device.

The UpdateDevices procedure that is called on the Form_Load event updates the controls of the dialog, but this will be discussed later.

Now add the click events for all 5 combo boxes and the 2 check boxes. On the click event of the device combo box, the currently selected device must be changed and all other combo boxes, the check boxes and the display of the serial number text field must be updated. This is done with the following code:

Private Sub cboDevice_Click()
    Dim Serial As String

    On Error GoTo err_cboDevice_Click
        'Open the device
        If cboDevice.Enabled Then
            Dim Item As Variant
            Dim index As Integer
            index = 1

            ImagingControl.Device = cboDevice.Text
            txtSerial.Text = NOT_AVAILABLE

            For Each Item In ImagingControl.Devices
                If Item.Name = cboDevice.Text Then
                    If ImagingControl.Devices.Item(index).GetSerialNumber(Serial) Then
                        txtSerial.Text = Serial
                        Exit For
                    End If
                End If
                index = index + 1
            Next

            ' Get supported video norms, formats and inputs
            UpdateVideoNorms
            UpdateInputChannels
            UpdateFlip
        End If

    Exit Sub
err_cboDevice_Click:
    MsgBox Err.Description
End Sub

After the new device is selected, its serial number is retrieved. If a serial number is not available, n/a is displayed. The procedures UpdateVideoNorms, UpdateInputChannels and UpdateFlip update the controls. They will be discussed later. Please note that the video format and the frame rate are updated implicitly by UpdateVideoNorms and UpdateVideoFormat.

The click events for the other combo boxes are quite similar. The click event for the cboVideoNorm combo box includes a procedure UpdateVideoFormats, which is used to update the video format combo box according to the selected video norm. The click event for the cboVideoFormat combo box includes a procedure UpdateFrameRates that updates the frame rate combo box after the video format has changed. The other combo boxes just set the currently selected value. Here is the code for the video norm combo box:

Private Sub cboVideoNorm_Click()
    On Error GoTo err_cboVideoNorm_Click

    If cboVideoNorm.Enabled Then
        ImagingControl.VideoNorm = cboVideoNorm.Text
    End If

    UpdateVideoFormats

    Exit Sub
err_cboVideoNorm_Click:
    MsgBox Err.Description
End Sub

The click events for the other combo boxes are implemented accordingly, except a minor detail, regarding the frame rate combo box. If you assign the new value for the frame rate, make sure you do a typecast, since cboFrameRate.Text returns a string, but ICImagingControl.DeviceFrameRate needs a floating point value.

Finally, add click events for the check boxes. They just toggle the horizontal and vertical flip:

Private Sub chkFlipV_Click()
    If ImagingControl.DeviceFlipVerticalAvailable Then
        ImagingControl.DeviceFlipVertical = (chkFlipV.Value = 1)
    End If
End Sub

The event for chkFlipH is implemented the same way.

The Update Procedures

As mentioned before, there is an Update procedure for every combo box and one for the two check boxes. The Update procedures for the combo boxes just fill the appropriate combo box with currently valid values. If the value that was selected before the update is still contained in the combo box, it is selected automatically. The code for the UpdateDevice procedure looks as follows:

Private Sub UpdateDevices()
    cboDevice.Clear
    If ImagingControl.Devices.Count > 0 Then
        Dim Item As Variant
        Dim index As Long

        For Each Item In ImagingControl.Devices
            cboDevice.AddItem Item.Name
        Next

        If ImagingControl.DeviceValid Then
            index = ImagingControl.Devices.FindIndex(ImagingControl.Device)
            cboDevice.ListIndex = index - 1
        Else
            cboDevice.ListIndex = 0
        End If
        cboDevice.Enabled = True
    Else
        cboDevice.AddItem NOT_AVAILABLE
        cboDevice.Enabled = False
        cboDevice.ListIndex = 0
    End If

End Sub

The Update procedures for the other combo boxes are implemented accordingly, but note that ImagingControl.DeviceFrameRates returns a collection that contains floating point values. Therefore, in the UpdateFrameRates procedure, you must typecast them into a string before you can add them to the combo box.

The UpdateFlip procedure checks whether there is a vertical or horizontal flip available with the current device and sets their current state if possible:

Private Sub UpdateFlip()
    If ImagingControl.DeviceFlipHorizontalAvailable Then
        chkFlipH.Enabled = True
        If ImagingControl.DeviceFlipHorizontal Then
            chkFlipH.Value = 1
        Else
            chkFlipH.Value = 0
        End If
    Else
        chkFlipH.Enabled = False
        chkFlipH.Value = 0
    End If

    If ImagingControl.DeviceFlipVerticalAvailable Then
        chkFlipV.Enabled = True
        If ImagingControl.DeviceFlipVertical Then
            chkFlipV.Value = 1
        Else
            chkFlipV.Value = 0
        End If
    Else
        chkFlipV.Enabled = False
        chkFlipV.Value = 0
    End If
End Sub

<< Programmer's Guide


Building an Application

This sample program shows you how to use all the building blocks from the previous chapters to create a real program.

In addition to the code already presented, it contains a tool bar, error handling and uses the built-in dialogs to select and set up a device.

First Application

The source code for this example is contained in the samples\VB6\DemoApp sample source directory.

<< Programmer's Guide


Performing Image Processing

This chapter shows you how to create your own image processing functions.

The source code to this sample application can be found in the samples\VB6\Image Processing 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 First Steps in Visual Basic 6 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 having made a selection, the program will display an error message and terminate.

Add 3 buttons to the form and label them Start Live, Stop Live and Process. Name them cmdStartLive, cmdStopLive and cmdProcess respectively. Now add the following code to the Click events of the buttons:

Private Sub cmdStartLive_Click()
    ICImagingControl1.LiveStart

    ' Store in VideoHasStarted whether a video stream
    ' has been started once. If VideoHasStarted is True,
    ' you can be sure that there is an image that can be processed.
    VideoHasStarted = True
End Sub

Private Sub cmdStopLive_Click()
    ICImagingControl1.LiveStop
End Sub

Dim x As Integer, y As Integer
Dim ImageData As Variant
ImageData = ICImagingControl1.MemoryGetImageData

Dim MaxX, MaxY As Integer
MaxY = ICImagingControl1.ImageHeight - 1
MaxX = ICImagingControl1.ImageWidth - 1

If ICImagingControl1.MemoryCurrentGrabberColorformat = ICY8 Then

    For y = 0 To MaxY
        For x = 0 To MaxX
            ImageData(x, y) = 255 - ImageData(x, y)
        Next x
    Next y

ElseIf ICImagingControl1.MemoryCurrentGrabberColorformat = ICRGB24 Then

    For y = 0 To MaxY
        For x = 0 To MaxX
            'blue
            ImageData(x * 3 + 0, y) = 255 - ImageData(x * 3 + 0, y)

            'green
            ImageData(x * 3 + 1, y) = 255 - ImageData(x * 3 + 1, y)

            'red
            ImageData(x * 3 + 2, y) = 255 - ImageData(x * 3 + 2, y)
        Next x
    Next y

Else
    MsgBox "Please select a different 'MemoryCurrentGrabberColorformat'"
    Exit Sub
End If

ICImagingControl1.MemoryReleaseImageData ImageData
ICImagingControl1.Display

First, an image is captured automatically when the LiveStop method is called. This can either be done directly by clicking the Stop Live button, or implicitly by clicking the Process button. The variable VideoHasStarted is used to determine whether live video has been started at least once, in which case image processing can be performed.

The image data returned by MemoryGetImageData can be accessed as a 2-dimensional array of bytes. The two nested for..next loops are typical for image processing algorithms, in that they access individual pixels of the image by specifying their coordinates. The algorithm shown here simply inverts the image. Finally, a call to MemoryReleaseImageData is required to release the image buffer.

The sample code above requires 8-bit or 24-bit image data, so we need to select an appropriate value for the MemoryCurrentGrabberColorformat Property:

Using Color Formats

If a image buffer format is selected, which has more than 8 bits per pixel, MemoryGetImageData will still return an array of bytes, but with a width that is a multiple of the image width. For instance, if the video format is RGB24(640x480), 640 by 480 pixels with 3 bytes per pixel, then the image buffer will be 1920 by 480 bytes in size.

For RGB24, the pixel data has to be interpreted as follows: The first byte of a row is the blue value of the first pixel, the second byte is the green value of the first pixel and the third byte is the red value of the first pixel. The fourth byte is the blue value of pixel 2, and so on.

And this is what the result will look like:

While possible and required in some cases, you should avoid using different formats for VideoFormat and MemoryCurrentGrabberColorformat, because the image data then needs to be converted, resulting in poor performance.

<< Programmer's Guide


Using Multiple Buffers

In the previous chapters, IC Imaging Control appeared to work with only one image buffer. In fact, IC Imaging Control uses multiple buffers to store image data. This chapter describes how multiple buffers are organized inside IC Imaging Control and in which way a program can access these buffers. Internally, IC Imaging Control uses a ring buffer to store image data. The next section will describe the idea behind the ring buffer concept.

What is a Ring Buffer

A ring buffer is an array of image buffers, which are accessed in the following way: IC Imaging Control writes the first frame, coming from a video capture device, to the first element of the ring buffer. The second frame is written to the second buffer and so on. As soon as a frame has been written to the last element of the ring buffer, IC Imaging Control writes the next frame to the first buffer, overwriting the image data of the first frame.

This concept has the following benefits:

  • The image from one image buffer can be processed, while incoming image data is being written to another buffer simultaneously.
  • Previously acquired images can be accessed without copying the image data. This is particularly useful, if an image processing function detects an event (e.g. motion detection) in the current image. It is possible to go back the number of frames the image buffer is large, minus 1 frame. In other words, you can look into the past.

How to Access Image Buffers

Index-based access to an image buffer is provided by the ImageBuffers collection. If, for example, you want to access the first buffer, you should use the following code:

Dim FirstBuffer As ImageBuffer

FirstBuffer = ICImagingControl1.ImageBuffers(1)

Locking Buffers

If you want to prevent IC Imaging Control from copying data to a buffer, you have to lock this buffer with a call to ImageBuffer.Lock. You may want to do so, if time intensive image processing is carried out on the buffer. If you do not lock the buffer, IC Imaging Control may overwrite the data in the buffer while you are processing its data.

You have to call ImageBuffer.Unlock to allow IC Imaging Control to copy data to the buffer again.

<< Programmer's Guide


Displaying Buffers on the ImageAvailable Event

This chapter shows how to control the display of image buffers using the ImageAvailable event.

Normally, IC Imaging Control shows the live display automatically in its control window. However, using the ImageAvailable event, this behavior can be changed, thus enabling an application to modify the image data in the buffer (image processing), before it is displayed.

The source code for this sample program can be found in the samples\VB6\Display Buffer 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 First Steps in Visual Basic 6 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.

Specifying the Size of the Ring Buffer

As described in the chapter Using Multiple Buffers, IC Imaging Control uses a ring buffer to manage multiple buffers. The number of buffers contained in the ring buffer may be specified in the property browser by clicking on the property ImageRingBufferSize. On the one hand, a large size reduces the probability that IC Imaging Control attempts to overwrite the buffer. However, on the other hand, a large ring buffer size uses a large amount of memory. Choosing a suitable ring buffer size should be based on balancing these two contrary aspects. For our application, a ring buffer size of 5 is suitable because no processing is carried out on the buffers.

Disabling the Automatic Live Display

Set LiveDisplay in the property browser to False. This prevents IC Imaging Control from displaying the live stream automatically.

Enabling Continuous Capture Mode

Set LiveCaptureContinuous in the property browser to True, in order to enable the continuous capture mode. In this mode, IC Imaging Control copies every frame automatically to the ring buffer. In addition, an ImageAvailable event is sent every time a frame has been copied completely to the ring buffer.

Adding Initialization Code

Set the ScaleMode property of your main form to "3 - Pixel". This enables us to use pixel values (instead of Twips) to resize the control.

Create a Form_Load event procedure and add the following code:

Private Sub Form_Load()
On Error GoTo err_Form_Load
    If Not ICImagingControl1.DeviceValid Then
        ICImagingControl1.ShowDeviceSettingsDialog

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

    ICImagingControl1.LiveDisplay = False
    ICImagingControl1.LiveCaptureLastImage = False
    ICImagingControl1.LiveCaptureContinuous = True

    cmdStop.Enabled = False
    ICImagingControl1.Width = ICImagingControl1.ImageWidth
    ICImagingControl1.Height = ICImagingControl1.ImageHeight

    Exit Sub
err_Form_Load:
    MsgBox Err.Description
End Sub

This enables the "Start" button only, if the currently selected video capture device is valid. The following lines with ControlName.Width = ControlName.ImageWidth set the size of the control as specified by the currently selected video format.

Implementing Start/Stop Commands

Add a button to the form, set its Caption to "Start" and its Name to "cmdStart". Add the following code to its click event procedure:

Private Sub cmdStart_Click()
On Error GoTo err_cmdStart
    ICImagingControl1.LiveStart
    cmdStart.Enabled = False
    cmdStop.Enabled = True
    Exit Sub
err_cmdStart:
    MsgBox Err.Description
End Sub

Add a second button to the form, set its Caption to "Stop" and its Name to "cmdStop". Add the following code to its click event procedure:

Private Sub cmdStop_Click()
On Error GoTo err_cmdStop
    cmdStart.Enabled = True
    cmdStop.Enabled = False
    ICImagingControl1.LiveStop
    Exit Sub
err_cmdStop:
    MsgBox Err.Description
End Sub

The ImageAvailable Event Procedure

Now, add an ImageAvailable event procedure to your code.

Insert the following lines of code to the event procedure:

Private Sub ICImagingControl1_ImageAvailable(ByVal BufferIndex As Long)
On Error GoTo Err_ImageAvailable_Handler

    Dim CurrentBuffer As ImageBuffer

    Set CurrentBuffer = ICImagingControl1.ImageBuffers(BufferIndex)
    ICImagingControl1.DisplayImageBuffer CurrentBuffer

Err_ImageAvailable_Handler:
    Debug.Print Err.Description
End Sub

The ImageAvailable event handler takes the BufferIndex as a parameter. BufferIndex is the index on the buffer that contains the last copied image in the ImageBuffers collection. CurrentBuffer is an ImageBuffer object that takes a reference to an image buffer. The image buffer referenced by BufferIndex in the ImageBuffers collection is assigned to CurrentBuffer. By calling ICImagingControl.DisplayImageBuffer with the parameter CurrentBuffer, the CurrentBuffer is displayed in the IC Imaging Control window.

<< Programmer's Guide


Accessing an Image Buffer

This example shows the how to handle image buffers.

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

Available Data Formats

Y800

The Y800 color format is an 8 bit monochrome format. Every pixel is represented by one byte. The organization of the pixels in the image buffer is from left to right and top down. In other words: The first byte of the image buffer corresponds to the first pixel of the first line of the image.

RGB8

The RGB8 color format is an 8 bit monochrome format. Every pixel is represented by one byte. The organization of the pixels in the image buffer is from left to right and bottom up. In other words: The first byte of the image buffer corresponds to the first pixel of the last line of the image.

RGB24

RGB24 is a 24 bit color format. Every pixel is represented by 3 bytes, while every byte of this triple corresponds to one color value. The letters 'RGB' mean Red, Green and Blue, so one byte represents the red value, one byte represents the green value and the last byte represents the blue value.

RGB32

RGB32 is a 32 bit color format. It is like RGB24, except that every pixel has an additional byte to store an alpha value. An alpha value describes the transparency of the pixel. Therefore, every pixel consists of 4 bytes. RGB32 is also referred to as RGBA, where the A stands for Alpha. The A value is not used in IC Imaging Control and is therefore always 0. As for the RGB24 pixel format, IC Imaging Control uses the BGRA byte order for the RGB32 pixel format. The organization of the pixels in the image buffer is from left to right and bottom up.

<< Programmer's Guide


Y800

The Y800 color format is an 8 bit monochrome format. Every pixel is represented by one byte. The organization of the pixels in the image buffer is from left to right and top down. In other words: The first byte of the image buffer corresponds to the first pixel of the first line of the image.

How to read and write pixel data

A video capture device, video format, FrameHandlerSink with a ImageBuffers collections, which defines the image data color format must have been setup. The following code fragments show step-by-step how to access and manipulate the pixel data of Y800.

First of all, we have to capture an image. Otherwise, the image buffer would be empty. To do so, live mode is started and FrameHandlerSink.SnapImage is called.

Accessing the buffer

To access the bytes of the image buffer, you can write buf[column,line] in C# and buf(column,line) in VB.NET.

In this example, we want to read out the first (upper left hand) two pixels of the image. In a second step we manipulate the first 3 pixels. Because Y800 images are stored top-down, the index of the first line is 0.

' Y800 is top-down, the first line has index 0
Dim y As Integer
y = 0

Dim txt As String
txt = "Image buffer pixel format is Y800" & vbCrLf
txt = txt & "Pixel 1: " & ImageData(0, y) & vbCrLf
txt = txt & "Pixel 2: " & ImageData(1, y)
txtOutput.Text = txt

Manipulating Image Data

Instead of only reading pixel data, it is, of course, possible to manipulate the data as well. The following code sets the upper left hand pixel to black and the next 2 pixels to gray and white. After this manipulation, the image is saved to a BMP file.

' Set the first pixel to 0 (black)
ImageData(0, y) = 0
' Set the second pixel to 128 (gray)
ImageData(1, y) = 128
' Set the third pixel to 255 (white)
ImageData(2, y) = 255

buf.ReleaseImageData ImageData

buf.SaveAsBitmap "Y800.bmp", ICY800

To check the result, open the saved image and take a look at the upper left hand pixels. They should look as follows:

<< Accessing an Image Buffer


RGB8

The RGB8 color format is an 8 bit monochrome format. Every pixel is represented by one byte. The organization of the pixels in the image buffer is from left to right and bottom up. In other words: The first byte of the image buffer corresponds to the first pixel of the last line of the image.

How to read and write pixel data

A video capture device, video format, FrameHandlerSink with a ImageBuffers collections, which defines the image data color format must have been setup. The following code fragments show step-by-step how to access and manipulate the pixel data of RGB8.

First of all, we have to capture an image. Otherwise, the image buffer would be empty. To do so, live mode is started and FrameHandlerSink.SnapImage is called.

Accessing the buffer

To access the bytes of the image buffer, you can write buf[column,line] in C# and buf(column,line) in VB.NET.

In this example, we want to read out the first (upper left) two pixels of the image. In a second step we manipulate the first 3 pixels. Because RGB images are stored bottom-up, the index of the first line is lines-1.

' RGB is bottom-up, the first line has index (lines-1)
Dim y As Integer
y = buf.Lines - 1

Dim txt As String
txt = "Image buffer pixel format is RGB8" & vbCrLf
txt = txt & "Pixel 1: " & ImageData(0, y) & vbCrLf
txt = txt & "Pixel 2: " & ImageData(1, y)
txtOutput.Text = txt

Manipulating Image Data

Instead of only reading pixel data, it is, of course, possible to manipulate the data as well. The following code sets the upper left hand pixel to black and the next 2 pixels to gray and white. After this manipulation, the image is saved to a BMP file.

    ' Set the first pixel to 0 (black)
    ImageData(0, y) = 0
    ' Set the second pixel to 128 (gray)
    ImageData(1, y) = 128
    ' Set the third pixel to 255 (white)
    ImageData(2, y) = 255

    buf.SaveAsBitmap "RGB8.bmp", ICY8

    buf.ReleaseImageData ImageData
End Sub

Private Sub cmdY800_Click()
    Dim buf As ImageBuffer
    Set buf = GrabImage("Y800")

    Dim ImageData As Variant
    ImageData = buf.GetImageData

    '<<y800print
    ' Y800 is top-down, the first line has index 0
    Dim y As Integer
    y = 0

    Dim txt As String
    txt = "Image buffer pixel format is Y800" & vbCrLf
    txt = txt & "Pixel 1: " & ImageData(0, y) & vbCrLf
    txt = txt & "Pixel 2: " & ImageData(1, y)
    txtOutput.Text = txt

To check the result, open the saved image and take a look at the upper left hand pixels. They should look as follows:

<< Accessing an Image Buffer


RGB24

RGB24 is a 24 bit color format. Every pixel is represented by 3 bytes, while every byte of this triple corresponds to one color value. The letters 'RGB' mean Red, Green and Blue, so one byte represents the red value, one byte represents the green value and the last byte represents the blue value.

Please note that the name RGB can be misleading, since the first byte of a pixel does not necessarily have to represent the red value. In the Windows© environment, RGB data is typically organized in the order BGR. This means that the first byte represents the blue value, the second byte represents the green value and the third byte represents the red value of a RGB24 pixel. IC Imaging Control uses BGR order for the RGB24 pixel format. The organization of the pixels in the image buffer is from left to right and bottom up.

How to read and write pixel data

A video capture device, video format, FrameHandlerSink with a ImageBuffers collections, which defines the image data color format must have been setup. The following code fragments show step-by-step how to access and manipulate the pixel data of RGB24.

First of all, we have to capture an image. Otherwise, the image buffer would be empty. To do so, live mode is started and FrameHandlerSink.SnapImage is called.

Accessing the buffer

To access the bytes of the image buffer, you can write buf[column,line] in C# and buf(column,line) in VB.NET.

In this example, we want to read out the first (upper left hand) two pixels of the image. In a second step, we manipulate the first 3 pixels. Because RGB images are stored bottom-up, the index of the first line is lines-1.

To calculate the x-coordinate of the pixel data, the number of bytes required for one pixel (3) is multiplied with the column of the pixel to be retrieved. After that, an offset is added to access the red, blue or green component of the pixel.

' RGB24 is bottom-up, the first line has index lines-1
Dim y As Integer
y = buf.Lines - 1

Dim txt As String
txt = "Image buffer pixel format is RGB24" & vbCrLf
txt = txt & "Pixel 1: "
txt = txt & "R=" & ImageData(0 * 3 + 2, y) & ", "
txt = txt & "G=" & ImageData(0 * 3 + 1, y) & ", "
txt = txt & "B=" & ImageData(0 * 3 + 0, y) & vbCrLf
txt = txt & "Pixel 2: "
txt = txt & "R=" & ImageData(1 * 3 + 2, y) & ", "
txt = txt & "G=" & ImageData(1 * 3 + 1, y) & ", "
txt = txt & "B=" & ImageData(1 * 3 + 0, y)
txtOutput.Text = txt

Manipulating Image Data

Instead of only reading pixel data, it is, of course, possible to manipulate the data as well. The following code sets the upper left pixel to red and the next 2 pixels to green and blue. After this manipulation, the image is saved to a .bmp file.

' Set the first pixel to red (255 0 0)
ImageData(0 * 3 + 2, y) = 255
ImageData(0 * 3 + 1, y) = 0
ImageData(0 * 3 + 0, y) = 0
' Set the second pixel to 128 (gray)
ImageData(1 * 3 + 2, y) = 0
ImageData(1 * 3 + 1, y) = 255
ImageData(1 * 3 + 0, y) = 0
' Set the third pixel to 255 (white)
ImageData(2 * 3 + 2, y) = 0
ImageData(2 * 3 + 1, y) = 0
ImageData(2 * 3 + 0, y) = 255

buf.ReleaseImageData ImageData

buf.SaveAsBitmap "RGB24.bmp", ICRGB24

To check the result, open the saved image and take a look at the upper left hand pixels. They should look as follows:

<< Accessing an Image Buffer


RGB32

RGB32 is a 32 bit color format. It is like RGB24, except that every pixel has an additional byte to store an alpha value. An alpha value describes the transparency of the pixel. Therefore, every pixel consists of 4 bytes. RGB32 is also referred to as RGBA, where the A stands for Alpha. The A value is not used in IC Imaging Control and is therefore always 0. As for the RGB24 pixel format, IC Imaging Control uses the BGRA byte order for the RGB32 pixel format. The organization of the pixels in the image buffer is from left to right and bottom up.

How to read and write pixel data

A video capture device, video format, FrameHandlerSink with a ImageBuffers collections, which defines the image data color format must have been setup. The following code fragments show step-by-step how to access and manipulate the pixel data of RGB32.

First of all, we have to capture an image. Otherwise, the image buffer would be empty. To do so, live mode is started and FrameHandlerSink.SnapImage is called.

Accessing the buffer

To access the bytes of the image buffer, you can write buf[column,line] in C# and buf(column,line) in VB.NET.

In this example, we want to read out the first (upper left) two pixels of the image. In a second step we manipulate the first 3 pixels. Because RGB images are stored bottom-up, the index of the first line is lines-1.

To calculate the x-coordinate of the pixel data, the number of bytes required for one pixel (4) is multiplied with the column of the pixel to be retrieved. After that, an offset is added to access the red, blue or green component of the pixel.

' RGB32 is bottom-up, the first line has index lines-1
Dim y As Integer
y = buf.Lines - 1

Dim txt As String
txt = "Image buffer pixel format is RGB32" & vbCrLf
txt = txt & "Pixel 1: "
txt = txt & "R=" & ImageData(0 * 4 + 2, y) & ", "
txt = txt & "G=" & ImageData(0 * 4 + 1, y) & ", "
txt = txt & "B=" & ImageData(0 * 4 + 0, y) & vbCrLf
txt = txt & "Pixel 2: "
txt = txt & "R=" & ImageData(1 * 4 + 2, y) & ", "
txt = txt & "G=" & ImageData(1 * 4 + 1, y) & ", "
txt = txt & "B=" & ImageData(1 * 4 + 0, y)
txtOutput.Text = txt

Manipulating Image Data

Instead of only reading pixel data, it is, of course, possible to manipulate the data as well. The following code sets the upper left hand pixel to red and the next 2 pixels to green and blue. After this manipulation, the image is saved as a .bmp file.

' Set the first pixel to red (255 0 0)
ImageData(0 * 4 + 2, y) = 255
ImageData(0 * 4 + 1, y) = 0
ImageData(0 * 4 + 0, y) = 0
' Set the second pixel to 128 (gray)
ImageData(1 * 4 + 2, y) = 0
ImageData(1 * 4 + 1, y) = 255
ImageData(1 * 4 + 0, y) = 0
' Set the third pixel to 255 (white)
ImageData(2 * 4 + 2, y) = 0
ImageData(2 * 4 + 1, y) = 0
ImageData(2 * 4 + 0, y) = 255

buf.ReleaseImageData ImageData

buf.SaveAsBitmap "RGB32.bmp", ICRGB32

To check the result, open the saved image and take a look at the upper left hand pixels. They should look as follows:

<< Accessing an Image Buffer


Performing Advanced Image Processing

This chapter illustrates how to perform sophisticated image processing.

The source code for this sample program can be found in the samples\VB6\Advanced Image Processing directory. Before looking at this chapter, we suggest that you first read chapter Displaying Buffers on the ImageAvailable Event.

Overview

This chapter illustrates how to:

  • display image buffers
  • render an overlay on the live image
  • process mouse events
  • process data contained in image buffers

The sample described in this chapter lets you draw a rectangle on the live image using the mouse. The region specified by the rectangle is used to check whether the live image has changed. If so, the changed image is displayed. The threshold for the difference between the images can be set by the user.

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 First Steps in Visual Basic 6 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 displays error message and terminates.

Add two buttons to the form and label them Device and Settings. Name them cmdDevice and cmdSettings respectively. If you click the "Device" button, a device selection dialog is displayed. After you have selected a valid device, setupDevice is called. This is a helper procedure, which sets up a FrameHandlerSink that is used to grab images. The sink is initialized with a ring buffer size of 5 and Y800 as color format. ICImagingControl.LiveDisplay is disabled, because the buffers are drawn by hand in this sample. The Settings button shows a dialog that allows you to adjust the VCDProperties of the currently selected device. The code for both buttons looks as follows:

Private Sub cmdDevice_Click()
    With ICImagingControl1

        If .DeviceValid Then
            If .LiveVideoRunning Then
                .LiveStop
            End If
        End If

        .ShowDeviceSettingsDialog

        If .DeviceValid Then
            cmdStart.Enabled = True
            cmdSettings.Enabled = True
            setupDevice
        End If
    End With
End Sub

Private Sub cmdSettings_Click()
    ICImagingControl1.ShowPropertyDialog
End Sub

Declaring Global Variables

Create a user data type named RECT to hold the coordinates for a rectangle by inserting the following code at the beginning of your main frame.

Private Type RECT
    Left As Long
    Top As Long
    Right As Long
    Bottom As Long
End Type

Now, insert three global variables.

Private DisplayBuffer As ImageBuffer
Private UserROI As RECT
Private UserROICommited As Boolean
Private Sink As FrameHandlerSink
  • DisplayBuffer will contain a reference to the buffer that will be displayed on the ImageAvailable event. When deciding whether displaying a new buffer is necessary, the new buffer is compared to DisplayBuffer.
  • UserROI will contain the region of interest the user has set with the mouse.
  • UserROICommited will be used to toggle between drawing and testing.

Adding the Mouse Event Procedures

Add event procedures for ICImagingControl's MouseDown, MouseUp, and MouseMove events. Insert the following code into the event procedures:

MouseDown:

If Not UserROICommited And (Button And vbLeftButton) Then
    UserROI.Left = XPos
    UserROI.Top = YPos
End If

MouseUp:

If Not UserROICommited And Not (Button And vbLeftButton) Then
    UserROI.Right = XPos
    UserROI.Bottom = YPos
End If

MouseMove:

If Not UserROICommited And (Button And vbLeftButton) Then
    UserROI.Right = XPos
    UserROI.Bottom = YPos
End If

Because we use Y800 as sink color format, the mouse positions are identical to the pixel positions in the image buffers. Thus, we can set the UserROI.bottom and .top members to YPos.

When using a bottom-up sink color format such as RGB8, you had to transform the mouse positions to ICImagingControl1.Height - YPos.

Adding Functionality to the Application

As described in Displaying Buffers on the ImageAvailable Event, create two buttons ( Start / Stop ), the Form_Load event procedure and an ImageAvailable event handler. Add the line DisplayBuffer.ForceUnlock to the Stop_Click event handler. This is necessary as the DisplayBuffer will be locked in the ImageAvailable event procedure. When the control is stopped, the DisplayBuffer needs to be unlocked. Insert the following code into the ImageAvailable handler:

Private Sub ICImagingControl1_ImageAvailable(ByVal BufferIndex As Long)
    Dim Region As RECT
    Region = NormalizeRect(UserROI)

    ContinousMode Region
End Sub

This event handler uses the function NormalizeRect to make sure the rectangle's coordinates are not exchanged, e.g. left greater than right. It also calls the sub ContinousMode to paint that rectangle onto the image buffer. NormalizeRect is implemented as follows:

Private Function NormalizeRect(ByRef val As RECT) As RECT
    Dim Tmp As Long
    Dim r As RECT
    r = val
    If r.Top > r.Bottom Then
        Tmp = r.Top
        r.Top = r.Bottom
        r.Bottom = Tmp
    End If
    If r.Left > r.Right Then
        Tmp = r.Left
        r.Left = r.Right
        r.Right = Tmp
    End If
    If r.Top < 0 Then
        r.Top = 0
    End If
    If r.Left < 0 Then
        r.Left = 0
    End If
    If r.Bottom >= ICImagingControl1.ImageHeight Then
        r.Bottom = ICImagingControl1.ImageHeight - 1
    End If
    If r.Right >= ICImagingControl1.ImageWidth Then
        r.Right = ICImagingControl1.ImageWidth - 1
    End If
    NormalizeRect = r
End Function

The sub ContinousMode is implemented in the following way:

Private Sub ContinousMode(Region As RECT)
    Dim DisplayArr As Variant

    If Not DisplayBuffer Is Nothing Then DisplayBuffer.Unlock
    Set DisplayBuffer = Sink.ImageBuffers.Active
    DisplayBuffer.Lock

    DisplayArr = DisplayBuffer.GetImageData
    DrawRectangleY8 DisplayArr, Region
    DisplayBuffer.ReleaseImageData DisplayArr

    ICImagingControl1.DisplayImageBuffer DisplayBuffer
End Sub

First the DisplayBuffer is unlocked. It is generally good practice to release locks that are no longer required, otherwise the control can not write to that buffer. Then the image buffer specified by BufferIndex of the ImageBuffers collection is assigned to DisplayBuffer. This buffer is locked with DisplayBuffer.Lock to prevent DisplayBuffer from being overwritten by IC Imaging Control. Then the DrawRectangleY8 sub procedure draws a rectangle specified by Region into the image buffer. To display the buffer, ICImagingControl.DisplayImageBuffer is called with DisplayBuffer as its parameter. The buffer now contains a white rectangle that represents the current region of interest.

Implemented this way, IC Imaging Control enables the user to select a region by painting a rectangle on the control while a live video is running.

Inserting the "CompareMode"

Now, we add the functionality to only update the display, if something changes in the region of interest. Create a button, named cmdROICommit and add the following code to it's click event procedure:

Private Sub cmdROICommit_Click()
    If Not UserROICommited Then
        UserROICommited = True
        cmdROICommit.Caption = "Reset ROI"
    Else
        UserROICommited = False
        cmdROICommit.Caption = "Set current ROI"
    End If
End Sub

When this button is clicked, the region of interest is committed. The application then switches to the "CompareMode". In this mode, the display is only updated, if something within the region of interest has changed. When the "CompareMode" is already running, the button toggles to "ContinousMode".

Updating the Code in the Event Procedures

Add the the following code to the cmdStart_Click event procedure:

cmdROICommit.Enabled = True

This enables the painting of the ROI every time you start the live video. This is named "ContinousMode" in this example.

Add the following code to the cmdStop_Click event procedure:.

If UserROICommited Then
    cmdROICommit_Click  ' Change CompareMode to ContinousMode.
End If
cmdROICommit.Enabled = False

This will reset the mode from "CompareMode" to "ContinousMode" when the "Stop" button is clicked and the "CompareMode" is active. Further, add the line cmdROICommit.Enabled = False to the Form_Load event procedure.

Then alter the code in the ImageAvailable event procedure:

Dim Region As RECT
Region = NormalizeRect(UserROI)

If Not UserROICommited Then
    ContinousMode Region
Else
    CompareMode Region
End If

This calls the appropriate sub procedures, depending on UserROICommited.

The "CompareMode" Procedure

The new ImageAvailable event procedure calls the sub procedure CompareMode, which is implemented as follows:

Private Sub CompareMode(Region As RECT)
    Dim ArrOld, ArrNew As Variant
    Dim IBOld, IBNew As ImageBuffer
    Set IBOld = DisplayBuffer
    Set IBNew = Sink.ImageBuffers.Active

    ArrOld = IBOld.GetImageData
    ArrNew = IBNew.GetImageData

    If CompareRegion(ArrOld, ArrNew, Region, sldThresholdSlider.Value) Then

        DisplayBuffer.Unlock
        Set DisplayBuffer = IBNew
        DisplayBuffer.Lock

        DrawRectangleY8 ArrNew, Region

        ICImagingControl1.DisplayImageBuffer DisplayBuffer
    End If

    IBOld.ReleaseImageData ArrOld
    IBNew.ReleaseImageData ArrNew
End Sub

This sub calls the CompareRegion sub function, which compares the region of interest of the image buffers. If they differ, the old DisplayBuffer is unlocked and the new image buffer IBNew is assigned to DisplayBuffer. DisplayBuffer then contains the new image. The new DisplayBuffer is locked to prevent it from being overwritten by IC Imaging Control. The region of interest is drawn as a rectangle into the buffer, and the buffer is displayed, using ICImagingControl.DisplayImageBuffer.

The CompareRegion Function

The CompareRegion function compares the region of interest of the two image data arrays Arr and Arr2. The differences of the pixels in the specified Region are added. The result is saved in GreyscaleDifference. After adding, GreyscaleDifference is divided by the count of pixels in the region. GreyscaleDifference is compared to the threshold value passed to the function. If the threshold is lower or equal to GreyscaleDifference, the regions differ and the function returns True, False otherwise. The CompareRegion function is implemented as follows:

Private Function CompareRegion(Arr As Variant, Arr2 As Variant, Region As RECT, Threshold As Long) As Boolean
    Dim PixelCount As Long
    PixelCount = (Region.Bottom - Region.Top) * (Region.Right - Region.Left)

    If PixelCount > 0 Then

        Dim GreyscaleDifference As Long
        GreyscaleDifference = 0

        Dim x, y As Long
        For y = Region.Top To Region.Bottom
            For x = Region.Left To Region.Right
                GreyscaleDifference = GreyscaleDifference + Abs(Arr(x, y) - Arr2(x, y))
            Next x
        Next y

        GreyscaleDifference = GreyscaleDifference / PixelCount

        If GreyscaleDifference > Threshold Then
            CompareRegion = True
        Else
            CompareRegion = False
        End If
    Else
        CompareRegion = False
    End If

End Function

<< Programmer's Guide


Creating an Overlay

This chapter shows you how to write text and draw graphics on the live video images.

The source code for this sample program can be found in the samples\VB6\Creating an Overlay directory.

Setting up the Project

First of all, create a new project and add IC Imaging Control to the form as shown in the FirstSteps chapter.

Then, insert three new buttons to your form and name them cmdSelectDevice, cmdLiveVideo and cmdImageSetting. Label the buttons Device, Start and Settings respectively. These buttons will be used to select the video capture device, start and stop the live video and open the image settings dialog.

Now, implement the handler subs for the three buttons:

Private Sub cmdSelectDevice_Click()
    cmdLiveVideo.enabled = False
    cmdLiveVideo.Caption = "Start"
    cmdImageSettings.enabled = False

    ' Stop the live video, if it runs.
    If ICImagingControl1.DeviceValid = True Then
        If ICImagingControl1.LiveVideoRunning Then
            'Stop the timer.
            Timer1.enabled = False
            ICImagingControl1.LiveStop
            cmdLiveVideo.Caption = "Start"
        End If
    End If

    ' Now, call the device settings dialog to select the device.
    ICImagingControl1.ShowDeviceSettingsDialog

    If ICImagingControl1.DeviceValid = True Then
        cmdLiveVideo.enabled = True
        cmdImageSettings.enabled = True
    End If
End Sub

Private Sub cmdLiveVideo_Click()
    If ICImagingControl1.DeviceValid Then
        MousePointer = vbHourglass
        If ICImagingControl1.LiveVideoRunning Then
            Timer1.enabled = False
            ICImagingControl1.LiveStop
            cmdLiveVideo.Caption = "Start"
        Else
            StartLiveVideo
            cmdLiveVideo.Caption = "Stop"
        End If
        MousePointer = vbNormal
    End If
End Sub

Private Sub cmdImageSettings_Click()
    If ICImagingControl1.DeviceValid Then
        ICImagingControl1.ShowPropertyDialog
    End If
End Sub

Also, implement a sub named StartLiveVideo. It is called by cmdLiveVideo_Click and will be used later to do the initial drawings in the overlay.

Run the program: You should be able to select a video capture device and see the live video.

Using the OverlayBitmap Object

IC Imaging Control provides a special object for drawing and writing on the live video. The object is called OverlayBitmap.

The OverlayBitmap object contains a bitmap, which has the same size as the video format, or the size of a frame filter that transforms the image data before the overlay bitmap is applied. An application can draw text and graphics on this overlay bitmap. The overlay bitmap is copied to each sample of the video. A dropout color can be specified to determine, which pixels of the overlay bitmap are transparent and therefore not copied to the live video.

The overlay bitmap can only be used, if ICImagingControl.LiveStart has been called at least once after the video format has been changed. It is only visible, if the live video is running.

Enabling and disabling overlay for device, sink and display paths

Since version 3.0, IC Imaging Control allows you to select whether the overlay is drawn on live video, on grabbed and recorded images, or both.

You can use ICImagingControl.OverlayBitmapPosition to set an ORed combination of PathPositions values that specify the path positions at which overlay bitmap objects are inserted.

Enabling the overlay bitmap is a two-step process: The OverlayBitmapPosition has to be set before starting live mode and determines, at which path positions overlay operations are possible. OverlayBitmap.Enable enables or disables the application of a specific overlay bitmap while live mode is running.

Accessing the OverlayBitmap Objects

To access one of the 3 OverlayBitmap objects, use ICImagingControl.OverlayBitmapAtPath. The parameter of that property selects the position of the OverlayBitmap that is accessed.

The ICImagingControl.OverlayBitmap property returns the OverlayBitmap for the device path.

Setting up the Overlay

A program can draw on any of the overlay bitmaps once live mode has been started. Live mode has to be started first, because the actual size and color format of the overlay bitmaps can depend on frame filters, thus it is impossible to determine the formats before.

The StartLiveVideo starts live video and then draws several graphics on the 3 overlay bitmaps:

Private Sub StartLiveVideo()
    Dim ob As OverlayBitmap
    FrameCount = 0

    If ICImagingControl1.DeviceValid = True Then

        ICImagingControl1.LiveStart

        ' Initialize overlay bitmaps
        SetupOverlay ICImagingControl1.OverlayBitmapAtPath(PATHPOSITION_DEVICE)
        SetupOverlay ICImagingControl1.OverlayBitmapAtPath(PATHPOSITION_DISPLAY)
        SetupOverlay ICImagingControl1.OverlayBitmapAtPath(PATHPOSITION_SINK)

        ' Display a coordinate system on the device overlay
        DrawCoordinatesystem ICImagingControl1.OverlayBitmapAtPath(PATHPOSITION_DEVICE)

        ' Load a  bitmap file and display it on the display overlay
        ShowBitmap ICImagingControl1.OverlayBitmapAtPath(PATHPOSITION_DISPLAY)

        ' Draw overlay info boxes
        DrawOverlayInfo ICImagingControl1.OverlayBitmapAtPath(PATHPOSITION_DEVICE)
        DrawOverlayInfo ICImagingControl1.OverlayBitmapAtPath(PATHPOSITION_DISPLAY)
        DrawOverlayInfo ICImagingControl1.OverlayBitmapAtPath(PATHPOSITION_SINK)

        ' Enable the timer. In the timer event handler sub, the current
        ' time is displayed.
        Timer1.enabled = True
        Timer1_Timer
    End If
End Sub

The SetupOverlay sub is used to initialize each of the 3 overlays. It is called after live mode has been started.

Private Sub SetupOverlay(ob As OverlayBitmap)

    ' Enable the overlay bitmap for drawing.
    ob.Enable = True

    ' Set magenta as dropout color.
    ob.DropOutColor = RGB(255, 0, 255)

    ' Fill the overlay bitmap with the dropout color.
    ob.Fill ob.DropOutColor

    ' Print text in red.
    ob.FontTransparent = True
    ob.DrawText RGB(255, 0, 0), 10, 10, "IC Imaging Control 3.0"

End Sub

The overlay is enabled by calling OverlayBitmap.Enable, and a text is displayed in the upper left hand corner of the bitmap. The sub also sets a dropout color.

Dropout Color

The OverlayBitmap.DropOutColor property of the OverlayBitmap object determines, which pixel color is transparent on the live video. Each pixel that has the dropout color is not copied to the live video. The dropout color can be set with Visual Basic's RGB function. It defaults to black. For this reason, the background of the text written above is transparent. The FontBackColor property of the OverlayBitmap object is set to black as default too.

In order to be able to use black color in the overlay, we change OverlayBitmap.DropOutColor to another color, for example magenta (RGB(255,0,255)). If the application is started, only a black image with our text can be seen. The image is black, because the overlay bitmap is black and the dropout color has been changed to magenta. Therefore, the overlay bitmap must be filled with magenta. The method OverlayBitmap.Fill does this for us. When the dropout color is changed, the text background is visible as a solid black rectangle. To hide this, the property OverlayBitmap.FontTransparent can be set to True.

Drawing a Coordinate Plane

In the next step, we are going to draw a coordinate plane, consisting of lines and labels. To do this, we are going to use the DrawLine and DrawText methods of the OverlayBitmap object. Additionally, we are going to change the font used to write the labels.

We are going to implement a new sub called DrawCoordinatesystem. We want to use an 8 dpi Arial font for the labels. To achieve this, a new StdFont object Font must be created. This object has font properties like font name, font size and other font attributes. Before changing the font, we save the current font in order to be able to restore it after we have completed the coordinate plane.

The Font property of the OverlayBitmap object receives the StdFont object. Now, the new font is used for all following OverlayBitmap.DrawText calls.

The complete sub that draws the coordinate plane is implemented as follows:

Private Sub DrawCoordinatesystem(ob As OverlayBitmap)
    Dim Col As Integer
    Dim Row As Integer
    Dim i As Integer
    Dim Font As New StdFont
    Dim OldFont As StdFont

    Font.Name = "Arial"
    Font.Size = 8

    With ob

        ' Calculate the center of the video image.
        Col = ICImagingControl1.Width / 2
        Row = ICImagingControl1.Height / 2
        Set OldFont = .Font
        .Font = Font

        .DrawLine RGB(255, 0, 0), Col, 0, Col, ICImagingControl1.Height
        .DrawLine RGB(255, 0, 0), 0, Row, ICImagingControl1.Width, Row

        For i = 0 To Row Step 20
            .DrawLine RGB(255, 0, 0), Col - 5, Row - i, Col + 5, Row - i
            .DrawLine RGB(255, 0, 0), Col - 5, Row + i, Col + 5, Row + i
            If i > 0 Then
                .DrawText RGB(255, 0, 0), Col + 10, Row - i - 7, i / 10
                .DrawText RGB(255, 0, 0), Col + 10, Row + i - 7, -i / 10
            End If
        Next

        For i = 0 To Col Step 20
            .DrawLine RGB(255, 0, 0), Col - i, Row - 5, Col - i, Row + 5
            .DrawLine RGB(255, 0, 0), Col + i, Row - 5, Col + i, Row + 5
            If i > 0 Then
                .DrawText RGB(255, 0, 0), Col + i - 5, Row - 17, i / 10
                .DrawText RGB(255, 0, 0), Col - i - 10, Row - 17, -i / 10
            End If
        Next
        .Font = OldFont

    End With

End Sub

Displaying the Current Time

To display the current time on the live video, a timer is inserted in the form. It is called timer1 by default and its timer interval is set to 1000 milliseconds in the property window. The timer event handler sub is called Timer1_timer. The current time is displayed in the lower right hand corner. It has a white font with a black background. Furthermore, it has its own font. Therefore, a StdFont object must be created and used, as described above. The property OverlayBitmap.FontTransparent is set to False and OverlayBitmap.FontBackColor is set to black (RGB 0 0 0).

Private Sub Timer1_Timer()

    If ICImagingControl1.LiveVideoRunning = True Then
        Set ob = ICImagingControl1.OverlayBitmapAtPath(PATHPOSITION_DEVICE)

        Dim OldFont As StdFont
        Set OldFont = ob.Font

        Dim Font As New StdFont
        Font.Name = "Arial"
        Font.Bold = True
        Font.Size = 14
        ob.Font = Font

        ' Draw the time in the lower left corner of the video window.
        Dim Col As Integer
        Dim Row As Integer
        Col = ICImagingControl1.Width - 81
        Row = ICImagingControl1.Height - 20

        ' Setup the background color and drawing mode.
        ob.FontTransparent = False
        ob.FontBackColor = RGB(0, 0, 0)

        ' Draw the text with white color.
        ob.DrawText RGB(255, 250, 250), Col, Row, Time

        ' Reset the font and drawing mode.
        ob.FontTransparent = True
        ob.Font = OldFont
    End If
End Sub

OverlayUpdate Event

IC Imaging Control provides an OverlayUpdate event. This event is called after a new frame has been delivered from the video capture device. Therefore, it is possible to insert individual information on to each frame (i.e. frame counter).

The OverlayUpdate sub in the example counts the frames in the variable FrameCount. The frame counter is used to draw a growing triangle. If the frame counter is greater than 25, it is reset to 0 and the triangle is deleted. Therefore, if a solid rectangle of the same size is drawn over the triangle. The color of the rectangle must be set to the DropOutColor to make it transparent. The method DrawSolidRect provides this functionality.

The OverlayUpdate event handler is implemented as follows:

Private Sub ICImagingControl1_OverlayUpdate(ByVal Overlay As ICImagingControl3Ctl.OverlayBitmap, ByVal SampleStartTime As Double, ByVal SampleEndTime As Double)
    Dim Font As New StdFont
    Dim OldFont As StdFont
    Font.Name = "Arial"
    Font.Size = 8

    With Overlay
        If Overlay.PathPosition = PATHPOSITION_DISPLAY Then

            FrameCount = FrameCount + 1

            If FrameCount > 25 Then
                 FrameCount = 0

                ' Delete the triangle.
                .DrawSolidRect .DropOutColor, 10, _
                                              ICImagingControl1.Height - 70, _
                                              62, _
                                              ICImagingControl1.Height - 9
            End If

            ' Draw the new triangle line.
            .DrawLine RGB(200, 255, 0), FrameCount * 2 + 10, _
                                        ICImagingControl1.Height - 10, _
                                        FrameCount * 2 + 10, _
                                        ICImagingControl1.Height - 10 - FrameCount

             ' Print the current frame number:

             ' Set the background color to the current dropout color
             ' and make the font opaque.
             .FontBackColor = .DropOutColor
             .FontTransparent = False

             ' Save the current font.
             Set OldFont = .Font

             ' Set the new created font.
             .Font = Font

             ' Draw the text.
             .DrawText RGB(200, 255, 0), 70, ICImagingControl1.Height - 19, Str(FrameCount) + "  "

             ' Restore the previously used font.
             .Font = OldFont

        End If
    End With

End Sub

GDI Functions in Visual Basic 6

The OverlayBitmap object does not provide all functionality of the graphic device interface (GDI). Therefore, the OverlayBitmap provides a method that returns a device context. The method is called GetDC. The bitmap of the OverlayBitmap object is already selected in the returned device context. It can be used for all GDI functions like BitBlt, Ellipse etc.

To use the GDI functions, they must be declared on top of the form's source code:

' The GDI (graphics device interface) functions
' must be declared before they can be used.
Private Declare Function CreateCompatibleDC Lib "gdi32.dll" _
                          (ByVal handle As Long) As Long

Private Declare Function DeleteDC Lib "gdi32.dll" _
                          (ByVal handle As Long) As Long

Private Declare Function SelectObject Lib "gdi32.dll" _
                          (ByVal DC As Long, ByVal HGDIObj As Long) As Long

Private Declare Function BitBlt Lib "gdi32.dll" ( _
                              ByVal hdcDest As Long, _
                              ByVal nXDest As Long, _
                              ByVal nYDest As Long, _
                              ByVal nWidth As Long, _
                              ByVal nHeight As Long, _
                              ByVal hdcSrc As Long, _
                              ByVal nXSrc As Long, _
                              ByVal nYSrc As Long, _
                              ByVal dwRop As Long _
                              ) As Boolean

A new sub ShowBitmap is implemented to demonstrate how to render a bitmap onto the overlay bitmap. It uses the GDI function BitBlt to copy one bitmap onto another. The sub contains a variable of Visual Basic's StdPicture type. It is used to load a bitmap from file. Also two long variables are declared, that receive the device contexts. BitBlt copies the bitmap data from one device context to another device context. Very important: The bitmap sizes of the StdPicture object must be converted in to pixels, because the overlay bitmap uses pixels as its units.

After the bitmap has been loaded and its size has been converted to pixels, the device context of the OverlayBitmap object is retrieved:

Set ob = ICImagingControl1.OverlayBitmap
obDC = ob.GetDC

If an error occurs or GetDC is called before LiveStart has been called, 0 is returned. This means, the device context does not exist at this time. This has to be checked by an if statement.

Once a valid device context has been retrieved, a second, compatible device context must be created. This is done by a call to the GDI function CreateCompatibleDC. With the GDI function SelectObject, the bitmap in the StdPicture object is selected in the new device context. As soon as these steps have been completed, the BitBlt function is called. The target coordinates are so calculated that the loaded bitmap appears in the upper right hand corner of the video image.

'
' ShowBitmap
'
' This sub demonstrates how to use OverlayBitmap.GetDC to blit a bitmap
' from a file on the live video.
' The bitmap will be blitted with transparency on the live video because
' it's background color is magenta (load the image "Hardware.BMP"
' with "Paint.exe" to verify this). Magenta is the currently set
' dropout color. The used GDI graphic functions are based on pixel units.
' Therefore, the scaling functions of Visual Basic are called to get the
' size of the loaded bitmap in pixels.
'
Private Sub ShowBitmap(ob As OverlayBitmap)
    Dim Pic As New StdPicture
    Dim PicWidth As Integer
    Dim PicHeight As Integer
    Dim obDC As Long
    Dim SourceDC As Long
    Dim Col As Integer

    ' Load a BMP file.
    Set Pic = LoadPicture(App.Path & "\hardware.bmp")

    ' Transform the size of the picture from himetric to pixel units.
    PicWidth = ScaleX(Pic.Width, vbHimetric, vbPixels)
    PicHeight = ScaleX(Pic.Height, vbHimetric, vbPixels)

    ' Calculate a column to display the bitmap in the
    ' upper right corner of Imaging Control.
    Col = ICImagingControl1.Width - 5 - PicWidth

    ' Get the DC of the OverlayBitmap object.
    obDC = ob.GetDC
    If obDC <> 0 Then
        ' Create a compatible DC that is used to hold the loaded bitmap.
        SourceDC = CreateCompatibleDC(obDC)
        If SourceDC <> 0 Then
            ' Select the loaded bitmap in the source DC.
            SelectObject SourceDC, Pic.handle

            ' Now blit the source DC in the overlay bitmap DC.
            ' This copies the loaded bitmap to the overlay bitmap.
            BitBlt obDC, Col, 5, PicWidth, PicHeight, _
                    SourceDC, 0, 0, 13369376  ' 13369376 is SRCCOPY

            ' Delete the DC source that is no longer needed to avoid handle leaks.
            DeleteDC SourceDC
        End If

        ' Release the DC.
        ob.ReleaseDC obDC
    End If
End Sub

Do not forget to delete the newly created device context by a call to the GDI function DeleteDC and to release the OverlayBitmap device context by a call to the method ReleaseDC of the OverlayBitmap object.

Setting the Overlay Path position

The end user of our example program can control which of the 3 overlay bitmaps are drawn on the live video. To change the PathPositions, the following helper sub is used:

Private Sub SetOverlayPathPosition(pos As PathPositions, enabled As Boolean)

    ' Remember whether live video has to be restarted
    Dim MustRestart As Boolean
    MustRestart = ICImagingControl1.LiveVideoRunning
    If MustRestart Then ICImagingControl1.LiveStop

    ' Adjust the overlay bitmap path position
    Dim newPP As PathPositions
    If enabled Then
        newPP = ICImagingControl1.OverlayBitmapPosition Or pos
    Else
        newPP = ICImagingControl1.OverlayBitmapPosition And Not pos
    End If
    ICImagingControl1.OverlayBitmapPosition = newPP

    ' Restart live video
    If MustRestart Then StartLiveVideo
End Sub

This sub enables or disables the overlay at a specified path position.

Setting the Overlay's Color Mode

An application can decide whether it wants a color or grayscale overlay. The OverlayBitmap.ColorMode property can be used to select one of the available color modes:

OVERLAY_COLORMODE_BESTFIT
The overlay bitmap format is chosen to match the format of the image stream at the position of the overlay bitmap.
OVERLAY_COLORMODE_COLOR
The overlay bitmap format is color. You can draw colored lines and text on the overlay.
OVERLAY_COLORMODE_GRAYSCALE
The overlay bitmap format is grayscale. You can only draw grayscale lines and text.

When the format of the image data stream does not match the overlay bitmap color mode, the image data is automatically converted.

<< Programmer's Guide


Scroll and Zoom

This chapter shows you how to use the scroll and zoom capabilities of IC Imaging Control.

The source code for this sample program can be found in the samples\VB6\Scroll And Zoom 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 First Steps in Visual Basic 6 chapter. Alternatively, run the program without selecting a device. In this case, the program shows the device selection dialog that ships with IC Imaging Control. If you close this dialog without making a selection, the program displays an error message and terminates.

Now add 2 buttons to the form and label them Start and Stop. Name the buttons cmdStart and cmdStop respectively.

Add a call to ICImagingControl.LiveStart method. In addition, a red rectangle is drawn around the whole image to visualize its perimeter:

Private Sub cmdStart_Click()
    ICImagingControl1.LiveStart
    With ICImagingControl1

        ' Draw a rectangle around the whole image to visualize its perimeter.
        .OverlayBitmap.Enable = True
        .OverlayBitmap.DrawLine RGB(255, 0, 0), 0, 0, .ImageWidth - 1, 0
        .OverlayBitmap.DrawLine RGB(255, 0, 0), .ImageWidth - 1, 0, .ImageWidth - 1, .ImageHeight - 1
        .OverlayBitmap.DrawLine RGB(255, 0, 0), .ImageWidth - 1, .ImageHeight - 1, 0, .ImageHeight - 1
        .OverlayBitmap.DrawLine RGB(255, 0, 0), 0, 0, 0, .ImageHeight
        .OverlayBitmap.DrawText RGB(255, 0, 0), 5, 5, "Scroll and Zoom Sample"
    End With
End Sub

Add a call to ICImagingControl.LiveStop:

Private Sub cmdStop_Click()
    ICImagingControl1.LiveStop
End Sub

Now add two check boxes and name them chkDisplayDefault and chkScrollbarsEnable. Label them Default window size and Scrollbars respectively. They will be used to set the LiveDisplayDefault and the ScrollBarsEnabled properties.

Also add a slider control to the form and name it sldZoom. It will be used to set the LiveDisplayZoomFactor property. In the property window of the slider, set the range of the slider from 1 to 30. The slider's value will be divided by 10, before it is passed to the LiveDisplayZoomFactor property. This allows a zoom from 10% up to 300%.

Now add 2 buttons to the form and label them Device and Settings. Name the buttons cmdDevice and cmdImageSettings respectively. Add the button handler functions:

Private Sub cmdImageSettings_Click()
    ICImagingControl1.ShowPropertyDialog
End Sub

Enhance the cmdDevice_Click procedure to setup the check boxes and the slider control:

Private Sub cmdDevice_Click()
    If ICImagingControl1.DeviceValid Then
        If ICImagingControl1.LiveVideoRunning Then
            ICImagingControl1.LiveStop
        End If
    End If

    ICImagingControl1.ShowDeviceSettingsDialog

    If Not ICImagingControl1.DeviceValid Then
        cmdStart.Enabled = False
        cmdStop.Enabled = False
        cmdImageSettings.Enabled = False
        chkDisplayDefault.Enabled = False
        chkScrollbarsEnable.Enabled = False
        sldZoom.Enabled = False
        lblZoom.Enabled = False
    Else
        cmdStart.Enabled = True
        cmdStop.Enabled = True
        cmdImageSettings.Enabled = True
        chkDisplayDefault.Enabled = True
        chkScrollbarsEnable.Enabled = True
        sldZoom.Enabled = True
        lblZoom.Enabled = True

        ICImagingControl1.LiveDisplayDefault = False
        chkDisplayDefault.Value = 0

        If ICImagingControl1.ScrollbarsEnabled = True Then
            chkScrollbarsEnable.Value = 1
        Else
            chkScrollbarsEnable.Value = 0
        End If

        ' Enable or disable the slider for the zoom factor, depending
        ' on the LiveDisplayDefault property.
        sldZoom.Enabled = Not ICImagingControl1.LiveDisplayDefault
        sldZoom.Value = ICImagingControl1.LiveDisplayZoomFactor * 10
        sldZoom_Scroll
    End If
End Sub

The check box chkDisplayDefault is used to toggle the LiveDisplayDefault property. Add a chkDisplayDefault_Click function to the form's source code. In this function, the current value of the chkDisplayDefault check box is retrieved and LiveDisplayDefault is set. Setting the LiveDisplayDefault property changes the value of the LiveDisplayZoomFactor property. Therefore, the value for the sldZoom slider control is updated to the LiveDisplayZoomFactor property value. Also, the slider control will be disabled, if the LiveDisplayDefault property returns True. If the LiveDisplayDefault property returns False, the slider control will be enabled, because now the zoom factor can be set.

Private Sub chkDisplayDefault_Click()
    If chkDisplayDefault.Value = 1 Then
        ICImagingControl1.LiveDisplayDefault = True
    Else
        ICImagingControl1.LiveDisplayDefault = False
    End If
    sldZoom.Enabled = Not ICImagingControl1.LiveDisplayDefault
    sldZoom.Value = ICImagingControl1.LiveDisplayZoomFactor * 10
    lblZoomPercent.Caption = Str(sldZoom.Value * 10) + "%"
End Sub

The check box chkScrollBarsEnable is used to enable and disable the scrollbars. Add a chkScrollbarsEnable_Click function to the form's source code. In this function, the current value of the chkScrollbarsEnable check box is retrieved and ScrollBarsEnabled is set. This allows you to show or hide the scrollbars in IC Imaging Control's window. Disabling the scrollbars will reset the live displays window position to 0/0.

Private Sub chkScrollbarsEnable_Click()
   If chkScrollbarsEnable.Value = 1 Then
        ICImagingControl1.ScrollbarsEnabled = True
    Else
        ICImagingControl1.ScrollbarsEnabled = False
    End If
End Sub

The Slider sldZoom is used to set the zoom factor of the live video image. Add a sldZoom_Scroll function to the form's source code, to handle the change of the slider control. Because the range of the slider has been set from 1 to 30, the slider's value has to be divided by 10, before it is passed to LiveDisplayZoomFactor.

Private Sub sldZoom_Scroll()
    If ICImagingControl1.LiveDisplayDefault = False Then
       ICImagingControl1.LiveDisplayZoomFactor = sldZoom.Value / 10
       lblZoomPercent.Caption = Str(sldZoom.Value * 10) + "%"
    Else
        MsgBox "The zoom factor can only be set" + Chr(13) + _
               "if LiveDisplayDefault returns False!"
    End If
End Sub

Run the program. You can now start and stop the live image by clicking on the respective buttons. You can enable or disable the LiveDisplayDefault property and see, how IC Imaging Control reacts. You can also show and hide the scrollbars and zoom the live video.

If the scrollbar values are changed, the functions OnHScroll and OnVScroll are called. The current scroll position is passed to these methods.

Add a new label to the form and name it lblScrollPosition. This new label is used to display the current scroll position. Also add the OnHScroll and OnVScroll event functions to the form's source code. Enhance both functions as follows:

Private Sub ICImagingControl1_OnHScroll(ByVal XPos As Long, ByVal YPos As Long)
    lblScrollPosition.Caption = Str(XPos) + "/" + Str(YPos)
End Sub

Private Sub ICImagingControl1_OnVScroll(ByVal XPos As Long, ByVal YPos As Long)
    lblScrollPosition.Caption = Str(XPos) + "/" + Str(YPos)
End Sub

Now, the current scroll position is displayed in the new label, each time, you scroll the live display with the scroll bars.

<< Programmer's Guide


Basic Use of VCD Properties

This chapter illustrates the basic functionality of the VCDProperties. It shows you how to retrieve interfaces which allow you to manipulate elements, such as the value or the automation state of a property.

Introduction

This sample uses the "Brightness" property to demonstrate how the properties are organized and how they are accessed. First, the VCDPropertyItem for "Brightness" is retrieved from the VCDPropertyItems collection. Then a switch and a range interface is retrieved from the respective elements of this VCDPropertyItem. The switch interface is used to turn the automation state of this property on and off. The range interface is used to manipulate the value of this property.

The source code for this sample program can be found in the samples\VB6\VCD Simple sample source directory.

Creating 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 First Steps in Visual Basic 6 chapter. Alternatively, run the program without selecting a device. In this case, the program shows the device selection dialog that ships with IC Imaging Control. If you close this dialog without selecting a device, the program displays an error message and terminates.

In order to specify a certain property, the module VCDPropertyID.bas must be added to the project. It can be found in the samples\VB6\common directory. The module contains the IDs that are needed to specify a property. To add the module to your project select Project from the menu and select Add Module. In the dialog, click the Existing tab and browse to the samples\VB6\common folder. Select the file VCDPropertyID.bas and click the Open button. The module is now part of your project.

Now add a check box and a slider (or 'trackbar') to the form. Name the check box chkBrightnessAuto and the slider sldBrightness.

Retrieving a VCDPropertyItem

After a valid video capture device has been selected, the VCDPropertyItem for "Brightness" is retrieved:

' Get the Brightness property item
Dim Brightness As VCDPropertyItem
Set Brightness = ICImagingControl1.VCDPropertyItems.FindItem(VCDID_Brightness)

Just declare a variable of type VCDPropertyItem and use the VCDPropertyItems.FindItem method to assign the appropriate property. The property item that should be retrieved must be specified by its ID as mentioned above. In this case, it is VCDID_Brightness for the "Brightness" property item.

Retrieving Interfaces and Initialize the Controls

Properties consist of one or more elements like the value, automation state, one push operation and further parameters, if supported. To manipulate a property, interfaces are used. They can be retrieved from the elements of a property item. Declare 2 global variables that will hold the interfaces to the value and the automation state:

Dim BrightnessRange As VCDRangeProperty
Dim BrightnessSwitch As VCDSwitchProperty

The following code shows you how to actually retrieve a switch and a range interface and how to get their current states in order to initialize the associated user controls.

If Not Brightness Is Nothing Then
    ' Get interfaces which allow to manipulate the property.
    Set BrightnessRange = Brightness.Elements.FindInterface(VCDElement_Value + ":" + VCDInterface_Range)
    Set BrightnessSwitch = Brightness.Elements.FindInterface(VCDElement_Auto + ":" + VCDInterface_Switch)
End If

The VCDPropertyElements.FindInterface method of the property item is used to retrieve an interface. As described above, a property item consists of one or more elements which provide one or more interfaces. Therefore, the element ID and the interface ID have to be specified when calling the VCDPropertyElements.FindInterface method.

Now that the we have the interfaces, the user controls can be initialized. The following code shows you how this is done:

' Initialize the slider with the current range and value of the
' Brightness property.
 If Not BrightnessRange Is Nothing Then
     sldBrightness.Min = BrightnessRange.RangeMin
     sldBrightness.Max = BrightnessRange.RangeMax
     sldBrightness.Value = BrightnessRange.Value
     sldBrightness.Enabled = True
 Else
     sldBrightness.Enabled = False
 End If

' Initialize the check box with the current automation state
' of the Brightness property.
 If Not BrightnessSwitch Is Nothing Then
     chkBrightnessAuto.Enabled = True
     If BrightnessSwitch.Switch Then
         chkBrightnessAuto.Value = 1
         sldBrightness.Enabled = False
     Else
         chkBrightnessAuto.Value = 0
         sldBrightness.Enabled = True
     End If
 Else
     chkBrightnessAuto.Enabled = False
 End If

As the code above shows, the interface classes let you easily access the elements of a property item.

Manipulating the elements of a Property

In this final step, we want to show you how to use the interfaces to manipulate a property. Add a Click event for the check box and a Scroll event for the slider. The check box toggles the automation state of the "Brightness" property. The code looks as follows:

Private Sub chkBrightnessAuto_Click()
On Error Resume Next
    ' Set the automation state of the Brightness property according to
    ' the switch.
    BrightnessSwitch.Switch = chkBrightnessAuto.Value
    If chkBrightnessAuto.Value = 1 Then
        sldBrightness.Enabled = False
    Else
        sldBrightness.Enabled = True
    End If
End Sub

The code above just assigns the current state of the check box to the automation element of the "Brightness" property. Additionally, the slider will be disabled, if the automation state is on.

The code for the Scroll event of the slider is even simpler:

Private Sub sldBrightness_Scroll()
On Error Resume Next
    ' value to the interface
    BrightnessRange.Value = sldBrightness.Value
End Sub

Now you can run the program and manipulate the "Brightness" property, using the slider and the check box.

<< Programmer's Guide


List VCD Properties

This chapter shows you how to retrieve all properties of a video capture device using the new VCD property interface.

All properties that are retrieved from the video capture device are displayed in a TreeView. The TreeView was chosen, because it perfectly matches the organization of the properties, since they establish a tree structure. The root of the tree is the VCDPropertyItems collection. The collection contains all VCDPropertyItems that are provided by the current video capture device. Every VCDPropertyItem has one or more VCDPropertyElements, which have one or more VCDPropertyInterfaces that are used to access the property.

The source code for this sample program is contained in the samples\VB6\List VCD Properties sample source 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 First Steps in Visual Basic 6 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 terminate.

This sample uses the module VCDPropertyID.bas and some user controls. They can be found in the directory samples\VB6\common. Before you can use them, you have to add them to the project. To add the module, select Project from the menu and then choose Add Module. In the dialog click on the Existing tab and browse to the samples\VB6\common folder. Select VCDPropertyID.bas and click Open. To include the user controls, select Project from the menu and choose Add User Control. Click on the Existing tab and browse to the samples\VB6\common folder. Select AbsValSlider.ctl and click the Open button. The other user controls, namely PushButton.ctl, RangeSlider.ctl, StringCombo.ctl and Switch.ctl are included the same way. Now you are ready to use the user controls.

Add 2 buttons to the form, name them btnSelectDevice and btnShowPage and label them Select Device and Show Property Page. They will be used to show the device settings and property page dialog provided by IC Imaging Control. Now add one instance of every user control to the form. Give them the same name as the control itself, e.g. name the AbsValSlider AbsValSlider. Each of the user controls represents a special type of interface derived from VCDPropertyInterface.

Now add an image list and a tree view to the form. The image list will contain the graphical elements that are used to visualize the tree. Therefore, it is very important to add the image list before the tree view, because otherwise it is not possible to bind the image list to the tree view. Name the image list TreeImageList and the tree view Tree. Using the right mouse button, click on the image list and select Properties from the context menu. Under the General tab choose the 16x16 format and make sure that UseMaskColor is checked. Now switch to the Color tab and set both, the Back- and the MaskColor to white. Finally switch to the "Images" tab and add the following images in the given order: slider.bmp, switch.bmp, button.bmp, combo.bmp, value.bmp, auto.bmp and item.bmp. All these bitmap files can be found in the directory of this sample. Now, the image list can be added to the tree view. To do so, right click button, on the tree view. Select Properties from the context menu and select the General tab in the properties dialog. Change the Style to 5 - tvwTreelinesPictureText and set ImageList to TreeImageList. This will bind the image list to the tree view.

Adding Functionality

Add the Click events for the Select Device and Show Property Page buttons and insert the following code:

Private Sub btnSelectDevice_Click()

    ' The device settings dialog needs the live mode to be stopped.
    If ICImagingControl1.LiveVideoRunning Then
        ICImagingControl1.LiveStop
    End If

    ' Show the device settings dialog
    ICImagingControl1.ShowDeviceSettingsDialog

    ' If no device was selected, exit the program.
    If Not ICImagingControl1.DeviceValid Then
        MsgBox "No device was selected."
        End
    End If
    ListAllPropertyItems
    ' Start live mode
    ICImagingControl1.LiveStart

    ' Query all properties of the video capture device and list
    ' them in a tree control.
    QueryVCDProperties
End Sub

Private Sub btnShowPage_Click()
    If ICImagingControl1.DeviceValid Then
        ICImagingControl1.ShowPropertyDialog
    End If
End Sub

Now add a Form_Load event and insert the code below:

Private Sub Form_Load()
    If ICImagingControl1.DeviceValid = False Then
        ' Show the device settings dialog.
        btnSelectDevice_Click
    End If

    If ICImagingControl1.DeviceValid = True Then
        ListAllPropertyItems
        ' Start live mode.
        ICImagingControl1.LiveStart
        ' Query all properties of the video capture device and list
        ' them in a tree control.
        QueryVCDProperties
    End If
End Sub

As you can see in the code above, the btnSelectDevice_Click and the Form_Load event both call the procedures ListAllPropertyItems and QueryVCDProperties. QueryVCDProperties fills the tree view with the properties of the current video capture device. Additionally, ListAllPropertyItems prints the tree structure of those properties to the debug output window. The debug output shows you the pure organization of the VCDProperties without taking care of other aspects like controls. Let's have a look at the code for the procedure ListAllPropertyItems:

Private Sub ListAllPropertyItems()

    On Error Resume Next

    Dim PropertyItem As VCDPropertyItem
    Dim PropertyElement As VCDPropertyElement
    Dim PropertyInterFace As VCDPropertyInterface ' Default interface type.

    ' Interface types for the different property interfaces.
    Dim Range As VCDRangeProperty
    Dim Switch As VCDSwitchProperty
    Dim AbsoluteValue As VCDAbsoluteValueProperty
    Dim MapString As VCDMapStringsProperty
    Dim Button As VCDButtonProperty

    ' Get all property items
    For Each PropertyItem In ICImagingControl1.VCDPropertyItems
        Debug.Print PropertyItem.name

        ' Get all property elements of the current property item.
        For Each PropertyElement In PropertyItem.Elements
            Debug.Print "    Element : " + PropertyElement.name

            ' Get all interfaces of the current property element.
            For Each PropertyInterFace In PropertyElement
                Debug.Print "        Interface ";

                ' Cast the current interface into the apropriate type to access
                ' the special interface properties.
                Select Case PropertyInterFace.InterfaceID
                    Case VCDInterface_AbsoluteValue:
                        Set AbsoluteValue = PropertyInterFace
                        Debug.Print "Absolut Value : " + Str(AbsoluteValue.Value)

                    Case VCDInterface_MapStrings:
                        Set MapString = PropertyInterFace
                        Debug.Print "Mapstring : " + MapString.String

                    Case VCDInterface_Switch:
                        Set Switch = PropertyInterFace
                        Debug.Print "Switch : ";
                        Debug.Print Switch.Switch

                    Case VCDInterface_Button:
                        Set Button = PropertyInterFace
                        Debug.Print "Button"

                    Case VCDInterface_Range:
                        Set Range = PropertyInterFace
                        Debug.Print "Range : ";
                        Debug.Print Str(Range.Value)
                End Select
            Next
        Next
    Next
End Sub

The three nested For Each loops in the code above reflects the tree structure of the VCDProperties. The first loop covers all available VCDPropertyItems and prints their names to the debug output. For each item, the second loop prints out all available VCDPropertyElements. The third loop prints out all types of interfaces that the element provides. Please note that the interfaces are sorted according to their extend of detail. The most detailed one is the "AbsoluteValue" interface, followed by the "MapStrings" interface. "Switch" and "Button" are detailed interfaces providing simple functionality: toggle On/Off, trigger. The "Range" interface is the most generic one, but does not provide a meaning for the values that represents. For example the "Brightness" range may be from 0 to 255. There is no way to tell, whether 0 or 255 is the maximum brightness value.

Now let's have a look at the QueryVCDProperties procedure. This procedure fills the tree view with appropriate values. The code for this procedure looks as follows:

Private Sub QueryVCDProperties()
    ' Erase the complete tree.
    Tree.Nodes.Clear

    ' Create the root node.
    Dim root As Node
    Set root = Tree.Nodes.Add(, , , "VCDPropertyItems")

    ' Query the VCDPropertyItems and fill the tree.
    QueryVCDPropertyItems root, ICImagingControl1.VCDPropertyItems

   ' Make sure the tree is expanded.
    root.Expanded = True
End Sub

The procedure above clears the tree view and creates a new root node. The root node is labeled VCDPropertyItems. Then the procedure QueryVCDPropertyItems inserts all available property items. This procedure looks as follows:

Private Sub QueryVCDPropertyItems(ParentNode As Node, PropertyItems As VCDPropertyItems)
    Dim PropertyItem As VCDPropertyItem

    ' Iterate through all VCDPropertyItems and insert them into the tree control.
    For Each PropertyItem In PropertyItems
        ' Create a new tree node for the property item.
        ' The item identifier string is stored in the key
        ' property of the tree node.
        Dim newNode As Node
        Set newNode = Tree.Nodes.Add(ParentNode, tvwChild, "", PropertyItem.name, 7, 7)

        ' Now query the elements of the property item.
        QueryVCDPropertyElements newNode, PropertyItem

        newNode.Expanded = True
    Next

End Sub

QueryVCDPropertyItems iterates through all available property items. For every item, it creates a new node. All of these nodes are direct children of the root node. The name of the VCDPropertyItem (e.g. "Brightness", "Gain" or "Exposure") is assigned to the Text property of the node. An empty string is assigned to the key property of the node. Then, QueryVCDPropertyElements is called for the new node. QueryVCDPropertyElements looks as follows:

Private Sub QueryVCDPropertyElements(ParentNode As Node, PropertyItem As VCDPropertyItem)
    ' generate a display name
    Dim name As String
    Dim Image As Integer
    Dim Element As VCDPropertyElement

    For Each Element In PropertyItem.Elements
        ' Create a name for the property element.
        Select Case Element.ElementID
            Case VCDElement_Value:
                name = "VCDElement_Value"
                Image = 5
            Case VCDElement_Auto:
                name = "VCDElement_Auto"
                Image = 6
            Case VCDElement_OnePush:
                name = "VCDElement_OnePush"
                Image = 3
            Case VCDElement_WhiteBalanceRed:
                name = "VCDElement_WhiteBalanceRed"
                Image = 5
            Case VCDElement_WhiteBalanceBlue:
                name = "VCDElement_WhiteBalanceBlue"
                Image = 5
            Case Else
                name = "Other Element ID"
                Image = 5
        End Select

        ' Create a tree node for the element and insert it into the tree control.
        ' The item and element identifier strings are stored in the key property
        ' of the tree node.
        Dim newNode As Node
        Set newNode = Tree.Nodes.Add(ParentNode, tvwChild, "", name + ": " + Element.name, Image, Image)

        ' Now query the interfaces of the property element.
        QueryVCDPropertyInterface newNode, Element

        ' Make sure the tree is expanded
        newNode.Expanded = True
    Next

End Sub

QueryVCDPropertyElements iterates through all available elements. For every element, it creates a new node. All of these nodes are children of the node which represents the VCDPropertyItem to which these VCDPropertyElements belong. The Select block determines the appropriate graphical tree element for the node and sets its base name, depending on the type of the element. The name of the VCDPropertyElement (e.g. "Value", "Auto" or "Enable") is added to the base name and then assigned to the Text property of the node. An empty string is assigned to the key property of the node. Then, QueryVCDPropertyInterface is called for the new node. QueryVCDPropertyInterface looks as follows:

Private Sub QueryVCDPropertyInterface(ParentNode As Node, PropertyElement As VCDPropertyElement)
    Dim name As String
    Dim Image As Integer
    Dim InterFace As VCDPropertyInterface

    ' Iterate through all VCDPropertyInterfaces of the passed VCDPropertyElement
    ' and insert them into the tree control.
    For Each InterFace In PropertyElement
        ' Create an appropriate interface name.
        Select Case InterFace.InterfaceID
              Case VCDInterface_AbsoluteValue:
                  name = "AbsoluteValue"
                  Image = 1
              Case VCDInterface_MapStrings:
                  name = "MapStrings"
                  Image = 4
              Case VCDInterface_Range:
                  name = "Range"
                  Image = 1
              Case VCDInterface_Switch:
                  name = "Switch"
                  Image = 2
              Case VCDInterface_Button:
                  name = "Button"
                  Image = 3
          End Select

          ' Insert the node.
          ' The element and interface identifier strings are stored in the key property
          ' of the tree node. The ParentNode.Key contains the item and the element identifier
          ' string. The strings are separated by a colon.
          Dim newNode As Node

          Set newNode = Tree.Nodes.Add(ParentNode, tvwChild, _
                                        InterFace.Parent.Parent.ItemID + ":" + _
                                        InterFace.Parent.ElementID + ":" + _
                                        InterFace.InterfaceID, name, Image, Image)
    Next
End Sub

QueryVCDPropertyInterface iterates through all available interfaces of an element. For every interface, it creates a new node. All of these nodes are children of the node which represents the VCDPropertyElement to which these VCDPropertyInterface belong. The Select block determines the appropriate graphical tree element for the node and sets its name, depending on the type of the interface. The name is then assigned to the Text property of the node. The interface path that consists of an itemID, an elementID and an interfaceID is assigned to the key property of the node. The interface node makes up a leaf of the tree.

Accessing and Manipulating a VCDProperty

Now that the tree is built, we want to access the properties. To do this, add a NodeClick event for the tree view and insert the following code:

Private Sub Tree_NodeClick(ByVal Node As MSComctlLib.Node)
    Dim InterFace As VCDPropertyInterface

    ' Hide all user controls.
    RangeFrame.Visible = False
    SwitchFrame.Visible = False
    MapStringsFrame.Visible = False
    ButtonFrame.Visible = False
    AbsValFrame.Visible = False

    ' Node is not a leaf
    If Node.Key = "" Then
        Exit Sub
    End If

    ' The FindInterface operation may fail, so ignore the error and check the return value.
    ' In this case the returned Interface is Nothing. The interface identifier string
    ' is stored in the Key property of the passed Node.
    Set InterFace = ICImagingControl1.VCDPropertyItems.FindInterface(Node.Key)

    If Not InterFace Is Nothing Then

        ' Show the user control matching to the type of the selected interface
        ' and initialize it by passing the interface to the user control's interface
        ' member.
        Select Case InterFace.InterfaceID
            Case VCDInterface_AbsoluteValue:
                ShowAbsoluteValueControl InterFace

            Case VCDInterface_MapStrings:
                ShowComboBoxControl InterFace

            Case VCDInterface_Range:
                ShowRangeControl InterFace

            Case VCDInterface_Switch:
                ShowSwitchInterface InterFace

            Case VCDInterface_Button:
                ShowButtonInterface InterFace

        End Select
    End If
End Sub

Now it becomes clear, why the keys of the interface nodes store the interface path. If you click an interface node, the appropriate control should appear on the form, so that you can manipulate the setting of the property. To get the correct interface, the method FindInterface is used. FindInterface needs the interface path (or GUID) as a parameter. The key of an interface node represents this interface path (or GUID). The Select block maps the appropriate user control to the desired interface and calls the respective "Show%%" procedure. These procedures set the Visible property of the user control to True, so that it can be used to manipulate the setting of the specified property. The ShowAbsoluteValueControl procedure for example is implemented as follows:

Private Sub ShowAbsoluteValueControl(InterFace As VCDPropertyInterface)
    AbsValSlider.AssignItf InterFace
    AbsValFrame.Visible = True
    AbsValFrame.Caption = InterFace.Parent.Parent.name ' Property item name
End Sub

The appropriate procedures for the other user controls are implemented in the same way.

<< Programmer's Guide


Using the VCD Simple Property Class

Up to the version 1.41 of IC Imaging Control, the properties of a device could be accessed using the properties %%Auto, %%AutoAvailable, %%Available, %%Default and %%Range. These properties have been depreciated as of version 2.0. The new VCD properties allow more detailed and generic access to the device's properties but require a little more code to be written. If you are happy with the old properties, a new helper class is introduced in version 2.0 that provides access methods to the VCD properties, which are similar to the old way. This chapter shows you how to use this helper class.

Setting up the Project

The source code for this sample program can be found in the samples\VB6\VCD Simple Property sample source directory. It also uses some files, which are located in the samples\VB6\common 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 First Steps in Visual Basic 6 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 having made a selection, the program will display an error message and terminate.

In order to use the VCDSimpleProperty class, some files have to be added to the project. Select Project from the menu and then choose Add Class Module. Now click on the Existing tab and browse to the samples\VB6\common directory. Select the file VCDSimpleProperty.cls and click Open. The class is now added to the project. Now we need to add two modules. To do this, select Project from the menu and then choose Add Module. In the dialog, click the Existing tab and browse to the samples\VB6\common directory. Mark the file VCDSimpleModule.bas and click the Open button. Do the same to add the file VCDPropertyID.bas. Now you are ready to use the VCDSimpleProperty class.

Accessing a Property

First, we add some controls to the form. They will allow us to manipulate a device property. Add a slider, a label and a check box to the form. Name the slider sldWhiteBalance, the label lblWhiteBalanceValue and the check box chkWhiteBalanceAuto. These controls will be used to manipulate the "WhiteBalance" property of a device.

Of course we need an instance of the helper class in order to use it. Therefore, add a global variable:

Private VCDProp As VCDSimpleProperty

The helper class and the controls are initialized in the Form_Load event, so add a Form_Load and insert the following code:

Private Sub Form_Load()
    ' If a device has not yet been selected, show the device selection dialog.
    If Not ICImagingControl1.DeviceValid Then
        ICImagingControl1.ShowDeviceSettingsDialog

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

    ICImagingControl1.OverlayBitmapPosition = PATHPOSITION_NONE

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

    ' Initialize the auto checkbox.
    If Not VCDProp.AutoAvailable(VCDID_WhiteBalance) Then
        chkWhiteBalanceAuto.Enabled = False
        cmdWhiteBalanceOnePush.Enabled = False
    Else
        VCDProp.Automation(VCDID_WhiteBalance) = False
    End If

    ' Initialize the slider and the label.
    If Not VCDProp.Available(VCDID_WhiteBalance) Then
        sldWhiteBalance.Enabled = False
    Else
        sldWhiteBalance.Enabled = True
        On Error Resume Next
        sldWhiteBalance.Min = VCDProp.RangeMin(VCDID_WhiteBalance)
        sldWhiteBalance.Max = VCDProp.RangeMax(VCDID_WhiteBalance)
        sldWhiteBalance.Value = VCDProp.RangeValue(VCDID_WhiteBalance)
        sldWhiteBalance.TickFrequency = (sldWhiteBalance.Max - sldWhiteBalance.Min) / 10
        lblWhiteBalanceValue = sldWhiteBalance.Value
    End If

    ' start live mode.
    ICImagingControl1.LiveStart
End Sub

To add functionality to the controls, add a Scroll event for the slider and a Click event for the check box. If these events are called, the "WhiteBalance" property is updated appropriately. The following code will do this:

Private Sub sldWhiteBalance_Scroll()
    ' Set the value for WhiteBalance.
    VCDProp.RangeValue(VCDID_WhiteBalance) = sldWhiteBalance.Value

    ' Display the current value for WhiteBalance.
    lblWhiteBalanceValue = VCDProp.RangeValue(VCDID_WhiteBalance)
End Sub

Private Sub chkWhiteBalanceAuto_Click()
    If chkWhiteBalanceAuto.Value = 1 Then
        VCDProp.Automation(VCDID_WhiteBalance) = True
        sldWhiteBalance.Enabled = False
    Else
        VCDProp.Automation(VCDID_WhiteBalance) = False
        sldWhiteBalance.Enabled = True
    End If
End Sub

Accessing advanced Properties

There are some properties that allow a more detailed access than the one described above. In case of "WhiteBalance" it is possible to specify a value for red and blue and to perform an automatic adjustment for a limited time called one push. These advanced properties can be accessed using the following IDs: VCDElement_WhiteBalanceBlue and VCDElement_WhiteBalanceRed. The "One Push" operation is triggered by calling the VCDSimpleProperty.OnePush method with either VCDID_WhiteBalance, VCDElement_WhiteBalanceBlue or VCDElement_WhiteBalanceRed as a parameter.

The following sample shows you how to access "WhiteBalanceBlue" and "WhiteBalanceRed" property. It will also access the "Brightness" property to show the difference between the standard property and the advanced way.

After setting up the project as described in the "Setting up the Project" section of this document, add some controls to the form. Add 3 sliders and name them sldBrightness, sldWhiteBalanceBlue and sldWhiteBalanceRed. Now add 2 check boxes. Label them Auto and name them chkBrightnessAuto and chkWhiteBalanceAuto respectively. Finally, add a button to the form and name it cmdWhiteBalanceOnePush. Label the button One Push.

Now add an instance of the helper class to your code:

Private VCDProp As VCDSimpleProperty

The helper class and the controls are initialized in the Form_Load event. Add a Form_Load event and insert the following code:

Private Sub Form_Load()

    ' If no device is selected yet, show the device selection dialog
    If Not ICImagingControl1.DeviceValid Then
        ICImagingControl1.ShowDeviceSettingsDialog

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

    ICImagingControl1.ScrollbarsEnabled = True

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

    ' Initialize the auto checkboxes
    If Not VCDProp.AutoAvailable(VCDID_Brightness) Then
        chkBrightnessAuto.Enabled = False
    Else
        VCDProp.Automation(VCDID_Brightness) = False
    End If

    If Not VCDProp.AutoAvailable(VCDID_WhiteBalance) Then
        chkWhiteBalanceAuto.Enabled = False
        cmdWhiteBalanceOnePush.Enabled = False
    Else
        VCDProp.Automation(VCDID_WhiteBalance) = False
    End If

    ' Initialize the brightness slider
    If Not VCDProp.Available(VCDID_Brightness) Then
        sldBrightness.Enabled = False
    Else
        sldBrightness.Enabled = True
        sldBrightness.Min = VCDProp.RangeMin(VCDID_Brightness)
        sldBrightness.Max = VCDProp.RangeMax(VCDID_Brightness)
        sldBrightness.Value = VCDProp.RangeValue(VCDID_Brightness)
        sldBrightness.TickFrequency = (sldBrightness.Max - sldBrightness.Min) / 10
        lblBrightnessValue = sldBrightness.Value
    End If

    ' Initialize the whitebalance blue slider
    If Not VCDProp.Available(VCDElement_WhiteBalanceBlue) Then
        sldWhiteBalanceBlue.Enabled = False
    Else
        sldWhiteBalanceBlue.Enabled = True
        sldWhiteBalanceBlue.Min = VCDProp.RangeMin(VCDElement_WhiteBalanceBlue)
        sldWhiteBalanceBlue.Max = VCDProp.RangeMax(VCDElement_WhiteBalanceBlue)
        sldWhiteBalanceBlue.Value = VCDProp.RangeValue(VCDElement_WhiteBalanceBlue)
        sldWhiteBalanceBlue.TickFrequency = (sldWhiteBalanceBlue.Max - sldWhiteBalanceBlue.Min) / 10
        lblWhiteBalanceBlueValue = sldWhiteBalanceBlue.Value
    End If

    ' Initialize the whitebalance red slider
    If Not VCDProp.Available(VCDElement_WhiteBalanceRed) Then
        sldWhiteBalanceRed.Enabled = False
    Else
        sldWhiteBalanceRed.Enabled = False
        sldWhiteBalanceRed.Enabled = True
        sldWhiteBalanceRed.Min = VCDProp.RangeMin(VCDElement_WhiteBalanceRed)
        sldWhiteBalanceRed.Max = VCDProp.RangeMax(VCDElement_WhiteBalanceRed)
        sldWhiteBalanceRed.Value = VCDProp.RangeValue(VCDElement_WhiteBalanceRed)
        sldWhiteBalanceRed.TickFrequency = (sldWhiteBalanceRed.Max - sldWhiteBalanceRed.Min) / 10
        lblWhiteBalanceRedValue = sldWhiteBalanceRed.Value
    End If

    ' start live mode
    ICImagingControl1.LiveStart
End Sub

As you can see above, the initialization of the sliders for the "WhiteBalanceBlue" and "WhiteBalanceRed" value is done in exactly the same way as the initialization of the slider for the "Brightness" value. The only difference is that you use the appropriate "Element ID" to specify the property instead of the "Item ID".

Now we need some events to update the properties accordingly. First, add a Scroll event for every slider. The code for the Scroll event of the "Brightness" slider looks as follows:

Private Sub sldBrightness_Scroll()
    VCDProp.RangeValue(VCDID_Brightness) = sldBrightness.Value
    lblBrightnessValue = VCDProp.RangeValue(VCDID_Brightness)
End Sub

The Scroll event for the "WhiteBalanceBlue" resp. "WhiteBalanceRed" slider is similar.

Add a Click event for both check boxes. The code for these looks as follows:

Private Sub chkBrightnessAuto_Click()
    If chkBrightnessAuto.Value = 1 Then
        VCDProp.Automation(VCDID_Brightness) = True
        sldBrightness.Enabled = False
    Else
        VCDProp.Automation(VCDID_Brightness) = False
        sldBrightness.Enabled = True
    End If
End Sub

Private Sub chkWhiteBalanceAuto_Click()
    If chkWhiteBalanceAuto.Value = 1 Then
        VCDProp.Automation(VCDID_WhiteBalance) = True
        sldWhiteBalanceBlue.Enabled = False
        sldWhiteBalanceRed.Enabled = False
        cmdWhiteBalanceOnePush.Enabled = False
    Else
        VCDProp.Automation(VCDID_WhiteBalance) = False
        sldWhiteBalanceBlue.Enabled = True
        sldWhiteBalanceRed.Enabled = True
        cmdWhiteBalanceOnePush.Enabled = True
    End If
End Sub

Now add the Click event for the cmdWhiteBalanceOnePush button and insert the following code:

Private Sub cmdWhiteBalanceOnePush_Click()
    VCDProp.OnePush (VCDID_WhiteBalance)
End Sub

<< Programmer's Guide


Capturing a Video File

This chapter shows you how to save a video stream as a compressed video file. In contrast to the Capturing an AVI File example, the MediaStreamSink is used to allow several video file formats to be recorded.

The source code for this sample program can be found in the samples\VB6\Capturing a Video File 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 selecting a device, the program will display an error message and terminate.

Now, add 3 buttons to the form and label them Start Live, Stop Live and Capture Video. Name the buttons cmdStartLive, cmdStopLive and cmdCaptureVideo respectively.

Add calls to IC Imaging Control's LiveStart and LiveStop methods:

Private Sub cmdStartLive_Click()
    ICImagingControl1.LiveStart
End Sub

Private Sub cmdStopLive_Click()
    ICImagingControl1.LiveStop
End Sub

Run the program. You can now start and stop the live image by clicking on the respective buttons. This does not yet create a video file, but is required to create a preview for the live video stream. This is usually required to set up the camera before actually starting to record.

The Video Recording Dialog

Now add another form to your project. Name it frmSaveVideo. Add a combo box for the available media stream containers (video file types) and a combo box for the available video codecs. Insert a text box for the video filename, and buttons to start and stop video capture. (You may want to load the sample project instead of creating the form manually).

In the FormLoad event, the combo boxes are filled with the names of all media stream containers and video codecs installed on your computer.

Private Sub Form_Load()

    ' Fill the combo box "cboMediaStreamContainer" with the available
    ' Media Stream Containers (video file types)
    Dim Container As MediaStreamContainer
    For Each Container In ImagingControl.MediaStreamContainers
        cboMediaStreamContainer.AddItem Container.Name
    Next
    cboMediaStreamContainer.ListIndex = 0

    ' Fill the combobox "cboVideoCodec" with the available
    ' video compressors (codecs).
    Dim Codec As AviCompressor
    For Each Codec In ImagingControl.AviCompressors
        cboVideoCodec.AddItem Codec.Name
    Next
    cboVideoCodec.ListIndex = 0

    cboVideoCodec.Enabled = GetSelectedMediaStreamContainer().CustomCodecSupported

    chkPause.Value = 0

End Sub

The Click event of the "Start Capture" button initializes the global Sink variable with the currently selected media stream container, codec and filename. The recording process is started by calling LiveStart:

Private Sub cmdStartCapture_Click()
    On Error GoTo cmdStartCapture_Click

    If txtFilename.Text = "" Then
        MsgBox "Please select an video filename first.", vbExclamation + vbOKOnly
        Exit Sub
    End If

    Sink.StreamContainer = GetSelectedMediaStreamContainer()

    If Sink.StreamContainer.CustomCodecSupported Then
        Sink.Codec = GetSelectedVideoCodec()
    End If

    Sink.FileName = txtFilename.Text

    If chkPause.Value = 1 Then
        Sink.SinkModeRunning = False
    Else
        Sink.SinkModeRunning = True
    End If

    ' Save old sink settings
    OldLiveMode = ImagingControl.LiveVideoRunning
    Set OldSink = ImagingControl.Sink

    ' Stop live mode to set a new sink
    ImagingControl.LiveStop

    ' Set the new sink
    ImagingControl.Sink = Sink

    ' Re-start live mode. Video capturing is now started, if the sink is running.
    ImagingControl.LiveStart

    cmdStartCapture.Enabled = False
    cmdStopCapture.Enabled = True
    cmdClose.Enabled = False

    Exit Sub
cmdStartCapture_Click:
    MsgBox Err.Description
End Sub

The Pause button is a check box with a graphical style. It is used to set and reset the MediaStreamSink.SinkModeRunning property. If the SinkModeRunning property is set to False, video capture is paused. This means, that only the sink path of the image stream is paused. The live video is still displayed, but the video is not saved to the video file. If the SinkModeRunning property is set to True, IC Imaging Control immediately continues video capture. A previously started video file will be continued.

Private Sub chkPause_Click()
    If chkPause.Value = 1 Then
        Sink.SinkModeRunning = False
    Else
        Sink.SinkModeRunning = True
    End If
End Sub

The video capture can be started even if the SinkModeRunning property is set to False. In this case, the image stream will be initialized and started and the live video is displayed. But the images are not saved to the video file until the SinkModeRunning property is set to True. This has the advantage that video capturing can be immediately started, paused and restarted on an event.

Finished. You can now run the program, select a codec and create a video file. Note that compressing a video stream is a highly CPU intensive operation and not all codecs will be able to work at full image resolution and full frame rate.

<< Programmer's Guide


Filter Inspector

This example demonstrates how to use frame filters to perform basic image processing.

It shows, how to:

  • Enumerate the available frame filters.
  • Create frame filter instances.
  • Set a frame filter to do image processing on live video.

The source code for this sample program can be found in the samples\VB6\Filter Inspector directory.

Using the Example

On the left side of the dialog box, there are two list boxes. The upper list box shows all filter modules that were found by IC Imaging Control. When you select one of the filter modules in this list, the lower list box displays the frame filters that can be loaded from the selected module.

When you click on one of the frame filters in the second list box, the filter is inserted in the Device Path. The live video displayed on the right side of the dialog box should now visualize the work of the frame filter.

You can click the Dialog... button to display the selected filter's property dialog.

If you select a new filter, the old filter will be removed and the new one will be used instead.

To see the untransformed image data from the video capture device, click the Remove button.

Initialization

In the Form_Load event, ICImagingControl is initialized. If no device has been selected, ShowDeviceSettingsDialog is used to display a device selection dialog box. An important part here is to disable graphic overlay completely by setting ICImagingControl.OverlayBitmapPosition to PATHPOSITION_NONE, thus avoiding interference with the possible color formats of the frame filters.

If Not ICImagingControl1.DeviceValid Then
    ICImagingControl1.ShowDeviceSettingsDialog

    If Not ICImagingControl1.DeviceValid Then
        Unload Me
        Exit Sub
    End If
End If

' Disable all overlays, so that they do not influence the
' color format of the image stream.
ICImagingControl1.OverlayBitmapPosition = PATHPOSITION_NONE

' Start live mode.
ICImagingControl1.LiveStart

Enumerating Available Frame Filters

To obtain a list of available frame filters, use ICImagingControl.FrameFilterInfos, which returns a collection of FrameFilterInfo objects.

Now we want to fill a list box with the names of the files in which the filters have been found. To do that, we look at each filter and add its module name to the list box, while filling ModulePaths with the module paths of the filters. The module names are not added, if the module path is already in the collection:

' Use a collection to save the full paths to the filter modules.
Set ModulePaths = New Collection

' For each filter info:
' - Check if the filter's path is already in the module paths collection
' - If not, add the module name to the filter module list box.
Dim info As FrameFilterInfo
For Each info In ICImagingControl1.FrameFilterInfos

    Dim found As Boolean
    found = False

    Dim path As Variant
    For Each path In ModulePaths
        If path = info.ModulePath Then
            found = True
        End If
    Next path

    If Not found Then
        lstModules.AddItem info.ModuleName
        ModulePaths.Add info.ModulePath
    End If
Next info

In the event handler, which is called when the user selects a filter module name from the list box, a second list box is filled with the names of the filters in that module:

Private Sub lstModules_Click()

    lstFrameFilters.Clear

    ' Get the full path to the selected module from the ModulePaths collection.
    Dim selectedModulePath As String
    selectedModulePath = ModulePaths(lstModules.ListIndex + 1)

    ' For each available frame filter, check whether the module path
    ' equals the selelected module path.
    Dim i As Integer
    For i = 1 To ICImagingControl1.FrameFilterInfos.Count

        If ICImagingControl1.FrameFilterInfos(i).ModulePath = selectedModulePath Then
            lstFrameFilters.AddItem ICImagingControl1.FrameFilterInfos(i).Name

            ' Save the index in the list box item data
            lstFrameFilters.ItemData(lstFrameFilters.ListCount - 1) = i
        End If

    Next i

End Sub

The loop fills a list box with all the frame filters that were loaded from the specified module. The index of the added filters in the original filter list (that was retrieved from ICImagingControl.FrameFilterInfos ) are stored in the list box's item data by setting ListBox.ItemData, thus allowing the filter info to be found when an end user clicks the item.

Creating Frame Filter Instances

When the user selects a filter from the filter list, the item data of the selected item is read, using ListBox.ItemData. Because we previously stored the filter's index in the list of available filters in the item data, we can use this number now to select the FrameFilterInfo in ICImagingControl.FrameFilterInfos:

' Retrieve the index from the list box item data.
Dim selectedFilterIndex As Integer
selectedFilterIndex = lstFrameFilters.ItemData(lstFrameFilters.ListIndex)

' Use the index to get the FrameFilterinfo.
Dim selectedFilterInfo As FrameFilterInfo
Set selectedFilterInfo = ICImagingControl1.FrameFilterInfos(selectedFilterIndex)

' Create the new FrameFilter instance.
Dim newFrameFilter As FrameFilter
Set newFrameFilter = ICImagingControl1.FrameFilterCreate(selectedFilterInfo)

The frame filter instance is created by calling ICImagingControl.FrameFilterCreate with the FrameFilterInfo object as its parameter.

Set the Frame Filter

To activate the frame filter, it has to be registered at the ICImagingControl object. The ICImagingControl.DeviceFrameFilters collection is cleared and the new filter is inserted. Device frame filters are used to transform the image data that comes from the video capture device.

' If live mode is active, stop.
Dim wasLive As Boolean
wasLive = ICImagingControl1.LiveVideoRunning
If wasLive Then ICImagingControl1.LiveStop

' Set the new frame filter.
ICImagingControl1.DeviceFrameFilters.Clear
ICImagingControl1.DeviceFrameFilters.Add newFrameFilter

' If live mode was active, restart.
If wasLive And ICImagingControl1.DeviceValid Then ICImagingControl1.LiveStart

Live mode has to be stopped in order to set a frame filter.

<< Programmer's Guide


Technical Articles

Complete list of all technical articles.

Concepts and Components

This chapter describes the components that make up IC Imaging Control and the basic concepts behind the library.

Frame Filters

With frame filters, a versatile and powerful way to manipulate image data is introduced. Besides other features, frame filters can be used to change or convert the video format of the image stream, implement image processing and control which frames are processed.

Debayering

Certain color cameras output image data in raw format, which is called Bayer format. This chapter discusses what is involved to transform this raw data into a real color format that can be displayed as a color image.

VCDProperties

VCD Properties provide a generic, hardware independent and extendable way to control the settings of a video capture device.

DCAMprop DLL

The DCAM Prop DLL that provided access to special DCAM properties in version 1.41 is not needed anymore, because these special properties can now be accessed and manipulated using the new VCD properties. This document describes alternatives for all functions and procedures of the DCAM Prop DLL.

<< IC Imaging Control ActiveX User's Guide


Concepts and Components

This chapter describes the components that make up IC Imaging Control and the basic concepts behind the library.

Introduction

IC Imaging Control is an API that covers all aspects of DirectShow that are related to managing, controlling and accessing imaging devices and image data. It simplifies the usage of DirectShow by maintaining hardware independence. The abstraction implemented by IC Imaging Control addresses all programmers who are familiar with frame grabbers. In other words: IC Imaging Control lets DirectShow look like a frame grabber.

Basic Components

Because the idea behind IC Imaging Control is to build something similar to a frame grabber, the main component IC Imaging Control provides methods to control the inputs, video formats, and the grabbing process which are typical for frame grabber APIs. In contrast to most frame grabber APIs, IC Imaging Control provides:

  • A sink concept for creating image stream files ( MediaStreamSink, MediaStreamContainer ) including software compression ( AviCompressor )
  • A sink concept for handling image buffers ( FrameHandlerSink ) with ring buffer management ( ImageBuffers, ImageBuffer ) including buffer locking and image data access through callbacks ( ImageAvailable event).
  • Advanced display capabilities including scrolling and zooming that can be controlled using properties and methods of the main component ICImagingControl.

The image data is generated by the video capture device as consecutive frames that build an image stream running from the device to the sink. If the display is activated, the image stream is split, feeding the sink and the display. In this case, the image stream is a graph that looks like a "Y" and consists of the following segments:

  • Device Path: Segment between the device and the split point
  • Display Path: Segment between the split point and the display
  • Sink Path: Segment between the split point and the sink

While the figure above illustrates the flow of image data, the next figure shows the relationship between the image stream and the classes.

Advanced Components

IC Imaging Control provides generic access to device properties, multiple overlays and filter chains at different locations of the image stream:

  • Generic device properties: Although DirectShow allows device independent code to be written, by using the two defined sets of properties VideoProcAmp and CameraControl, this concept suffers from serious limitations. On the one hand, a lot of video capture devices provide more properties, than defined by DirectShow. On the other hand, the values that may be specified for a property do not have a meaning. With VCDProperties, IC Imaging Control provides a totally generic and extendable way to handle unknown properties and add a meaning to property values.
  • Multiple Overlays: The class OverlayBitmap implements an overlay that can be rendered on the image stream at three locations: device path, display path and sink path. Methods for drawing text and graphical elements, such as rectangles and lines, as well as callbacks for generating frame based overlays are provided.
  • Filter Chains: IC Imaging Control allows filters or filter chains to be inserted in the image stream at three locations: device path, display path and sink path. Filters are called frame filters and are used to change or convert the video format of the image stream, implement image processing and control which frames are processed. For details on frame filters, please refer to the section Frame Filters.

Performance

As described above, IC Imaging Control provides very powerful components to manipulate and control the acquisition and display of image streams. It is obvious that this functionality requires a certain overhead for internal management and processing. This may lead to the conclusion that IC Imaging Control is not suitable for high speed image processing application. This is absolutely not the case, as all features that make it easy to build complex applications with IC Imaging Control may be switched off. For applications that require as much CPU time for image processing as possible, IC Imaging Control may be configured in a way that the overhead to process the image stream is comparable to a low level frame grabber or FireWire library. In order to reduce the internal overhead to a minimum, you have to:

  • Switch off the display: this will remove the display path completely from the image stream.
  • Prevent automatic color space conversion: by specifying the same video format for the device and the sink.
  • Switching off all overlays.
  • Do not use the ring buffer: by inserting one frame filter in the sink path that will implement the image processing or interface a third party image processing library instead of sending frames to the sink.
  • Do not insert additional frame filters in the device path or in the sink path.

Doing so guarantees that the image data is not modified or copied by IC Imaging Control nor DirectShow. The figure below shows the layout of the image stream for this configuration.

<< Technical Articles


Frame Filters

With frame filters, a versatile and powerful way to manipulate image data is introduced. Besides other features, frame filters can be used to change or convert the video format of the image stream, implement image processing and control which frames are processed.

Introduction

In contrast to other DirectShow libraries, the frame filters of IC Imaging Control are not DirectShow filters. But they are executed in the context of a DirectShow thread that processes the image stream. This saves the programmer the hassle of creating a DirectShow filter module, registering it and defining interfaces for the parameters. Frame filters are implemented in C++ as part of a filter module. They are loaded on demand by the OCX from the module and may be inserted at three locations in the image stream. Frame filters are basically far easier to implement and to use as DirectShow filters by providing the same performance with regard to image processing. In VB 6, there is no way to neither implement a frame filter nor a frame filter module. VB.NET and C# allow frame filters to be implemented as part of a program. In order to create a frame filter module, C++ has to be used.

Filter Categories

Frame filters open the door to a vast number of new IC Imaging Control based applications. In order to show you what is possible with this new concept, we discuss categories of tasks that can be implemented with frames filters. For some of these tasks, frame filters are shipped with IC Imaging Control.

Gate:
Gate filters drop unwanted frames based on image analysis or other information like the frame count or time stamps.
Color Space Conversion:
All kinds of transformations from one color format to another fall in to this category. In addition, the reduction of the pixel depth, e.g. extracting the 8 most significant bits out of a 10 or 12 bit monochrome format is regarded as a color space conversion. The reduction of the pixel depth is used to display a 10 or 12 bit monochrome image. A good example for a color space conversion is the DeBayer Filter contained in stdfilters.ftf. It converts color raw data in Bayer format to RGB.
ROI:
Filters in this category allow a Region Of Interest to be cropped out of an image stream. The ROI Filter that is contained in stdfilters.ftf implements this functionality.
Rotation:
This category includes rotatation and flipping. The Rotate Flip Filter that is contained in stdfilters.ftf provides rotation by 90°, 180° and 270°, aswell as flipping on the horizontal and vertical axis. There is a filter in the DemoFilter.ftf that provides rotation by any angle, but this filter is a demo implementation and very slow.
Scaling:
Scaling up and down may be necessary to match a predefined display size or to save disk space for surveillance applications.
Sink:
Sink filters are consumers. They process the image stream in their Transform method completely and do not send frames to the IC Imaging Control sink. If you want to use professional high performance codecs, you would inplement a sink filter in order to interface the codec's API. This approach is necessary because most professional codecs come as a DLL instead of a DirectShow codec. These codecs provides functionality to compress image data and write it to a file at the same time, which makes a sink obsolete. Of course, you could use the ImageBuffers of a FrameHandlerSink to access the image data and send it to the codec's API. In this case, the image data would have been copied by the sink to the ImageBuffers which is not the case, if the codec is interfaced using a frame filter. In other words, the sink filter approach saves one copy operation per frame, which can increase the performance significantly, especially if large frames are processed.
Extraction:
Extraction filters take specific frames out of the image stream and apply processing on them, e.g. saving them to disk as image files. The image stream itself remains unchanged and is sent further to the sink. Such a filter allows specific images to be saved uncompressed, while a MediaStreamSink generates a compressed video file.
Image Processing:
All image processing functions that produce one image as output can be implemented easily by a frame filter. For functions that produce more than one image, special concepts have to be developed. One possible concept would be to write the output images one after the other into the resulting image. If data other than images is generated by the function (e.g. data generated by a blob analysis), the application could read out this data by using filter parameters.
Buffer Format Conversion:
Most image processing libraries have a special internal image buffer format. Frame filters can be used to convert image buffers of the image stream to such a special image buffer format. Doing so, the elements in the ring buffer of the FrameHandlerSink contain data in the special format. Therefore, the data of these buffers may be passed directly to the according image processing library. This saves one copy step and, therefore, increases the preformance of the system.

Using Existing Frame Filters

As described earlier, in VB 6 frame filters can only be loaded from a filter module. IC Imaging Control provides some filters in the module stdfilters.ftf. In order to obtain a list of the frame filters in all currently available filter modules, examine the ICImagingControl.FrameFilterInfos collection. With the property FrameFilterPath, an additional path for filter modules may be specified. A call to FrameFilterCreate or FrameFilterCreateString creates an instance of a filter that was selected from the list of available filters. Now that we have a frame filter instance, we can insert it at three different locations in the image stream:

  • Behind the device: DeviceFrameFilters
  • In front of the display: DisplayFrameFilters
  • In front of the sink: MediaStreamSink.FrameFilters, FrameHandlerSink.FrameFilters

Please note that the same instance of a frame filter should not be used at more than one place in the image stream because its internal state may get inconsistent. If it is necessary to insert the same filter at more than one location in the image stream, different instances of the frame filter should be used.

The internal data of a frame filter can be accessed through the parameter interface. With the property FrameFilter.Parameter, the following basic data types can be read from or written to the filter: bool, long, float and string. A block of binary data can be exchanged with a frame filter through the FrameFilter.Data property. Since the transform method of a filter is executed within a DirectShow thread, it is very important to synchronize external and internal access to the filter's data. Therefore, it is very important that a sequence of calls to the four methods mentioned above is preceded by a call to FrameFilter.BeginParameterTransfer and is followed by a call to FrameFilter.EndParameterTransfer.

If a frame filter is used by generic applications, such as the Filter Inspector, a dialog should be implemented that allows the parameters to be altered interactively. A frame filter indicates that it provides a parameter dialog by returning true in the method FrameFilter.HasDialog. The dialog should be displayed when the method FrameFilter.ShowDialog is called.

The internal state of a frame filter can be serialized using the property FrameFilter.FilterData. The data is string compatible. To save the settings directly to a file, use the FrameFilter.SaveFilterData and FrameFilter.LoadFilterData methods.

<< Technical Articles


Debayering

Certain color cameras output image data in raw format, which is called Bayer format. This chapter discusses what is involved to transform this raw data into a real color format that can be displayed as a color image.

Introduction

IC Imaging Control provides built-in functionality to debayer raw image data. There are 3 methods ( DeBayerActive, DeBayerStartPattern and DeBayerMode ) that allow the debayering process to be controlled. The prerequisite to use this buit-in functionality is that the camera provides BY8 video formats that identify raw data in Bayer format. Some cameras provide only grayscale video formats (e.g. Y800, RGB8 etc.) but output color raw data when these formats are selected. This is possible because the color raw data in Bayer format consists of only one value per pixel (for detailed information about color raw data, please refer to the glossary of our website www.theimagingsource.com and search for Bayer camera ). In this case the debayering has to be done explicitly by using the DeBayer frame filter that can be loaded from the StdFilters.ftf module.

Automatic Debayering

If a BY8 video format is selected, IC Imaging Control applies debayering to the image data. The method DeBayerActive can be used to determine whether automatic debayering is active. For details on debayering modes and parameters, please refer to DeBayerStartPattern and DeBayerMode. In order to switch off automatic debayering for the sink, you have to assign a bayer format, e.g. eBY8 or "BY8" to the sink ( MemoryCurrentGrabberColorformat, FrameHandlerSink.FrameTypes ). The only way to switch off automatic debayering for the display is to insert a frame filter in the display path that accepts only a bayer format at the input and outputs a monochrome format. All this filter has to do is to copy the data from the input to the output without any changes. In the filter module StdFilter.ftf, there is a filter Bayer To Y800 that does exactly this. The following code fragment shows how to display raw color data in Bayer format:

Explicit Debayering

In oder to apply debayering explicitly to the image stream, you have to load the DeBayer frame filter from the StdFilter.ftf module, insert it in to the desired segment of the image stream and setup the filters parameters to match the Bayer pattern and the desired algorithm:

For details on frame filters please refer to Frame Filters.

<< Technical Articles


VCDProperties

VCD Properties provide a generic, hardware independent and extendable way to control the settings of a video capture device.

Introduction

DirectShow defines two sub sets of properties for video capture devices: VideoProcAmp and CameraControl. There is only one scalar data type ( long ) defined to represent a property value. Although this concept is an abstraction that allows you to write device independent code, there are two problems:

  • Some video capture devices provide more properties than the ones defined by DirectShow.
  • If the values of some properties such as "exposure" are mapped to a "long", the meaning of the value gets lost. With regard to "exposure" the question is for example: which value corresponds to 1/20.000 sec? There is an approach in DirectShow to overcome this problem with negative values. The value -2, for example, means 2 to the power of -2, which is 1/4 seconds. These negative values are called "physical values" because they have a physical meaning (in this case in terms of seconds). There is one problem with this approach, it suffers from inaccuracy. There is no way to specify 1/3 second as an exposure time in "physical values". There is the same problem with the properties "iris" and "zoom".

On one hand, the new VCD properties provide interfaces that allow property values to manipulated in terms of physical dimensions, such as seconds. On the other hand, these interfaces provide high precision. For all who are happy with the simple and somehow restricted way of accessing properties provided by earlier versions of IC Imaging Control, there is a helper class called VCDSimpleProperty. This class allow old code to be ported with minimum effort. If this class is used, the benefits of the new VCD properties are not available.

Basic concepts

VCD properties are organized in a tree structure. In order to understand this, we have to consider the elements of which a property consists. First of all, a property has a name, such as "exposure". In addition, it contains elements, such as the value and an automation state. Therefore, we may say that a property is an object that contains a name and a set of elements. This object is called VCDPropertyItem. The elements are called VCDPropertyElement and contain a set of interfaces that allow to manipulate the element. The interfaces provide different access methods to the property. The interface VCDRangeProperty, for example, provides access to the property that is equivalent to the property access of DirectShow. The VCDAbsoluteValueProperty allows the property to be accessed in terms of a physical dimension with high accuracy. After this consideration, the structure of VCD property is clear: The property item contains property elements, which contain one or more interfaces. In order to be able to manipulate a property, you have to retrieve the appropriate item, element and interface. Please open the application "VCD Property Inspector" from the IC Imaging Control start menu entry, in order to get an idea on how the VCD properties are organized for your device.

Finding Property objects

First of all, we need a way to specify a property item, element or interface in order to be able to find it. There are GUIDs (Global Unique IDentifiers) for every property item, element and interface defined in the module VCDPropertyIDs. These GUIDs should be used in the VCD property's find methods. All property items that are supported by the currently active video capture device are contained in the VCDPropertyItems collection. This collection provides methods for retrieving a property item, element or interface. They are called VCDPropertyItems.FindItem, VCDPropertyItems.FindElement and VCDPropertyItems.FindInterface. The object to be retrieved has to specified by a single GUID for FindItem and a combination of GUIDs for the other two. In the following, we will call the GUID or combination of GUIDs that specifiy a property object, a GUID path.

Finding Interfaces

As described earlier, an interface is the object that actually allows data to be read from and written to a property. As described in the previous section, we use the GUID path for the desired interface as a parameter to VCDPropertyItems.FindInterface in order to retrieve the interface. Before we do this, we will have to decide which interface we want to use. In case of an auto item ( VCDPropertyElement, GUID: VCDElement_Auto) we will try to retrieve a switch interface ( VCDSwitchProperty, GUID: VCDInterface_Switch) because a switch is the expected functionality of the auto item. In case of the value item - the actual value of the property - we have to search for the best interface. The best or most advanced interface is the absolute value interface ( refer to VCDAbsoluteValueProperty for details).

As described at the beginning, the absolute values interface provide high accuracy and a meaning of the value it represents. The following code retrieves the absolute value interface for the value element of the exposure property item:

' Declare an absolute value interface
Dim AbsValItf As VCDAbsoluteValueProperty

' Retrieve an absolute value interface for exposure
Set AbsValItf = ICImagingControl1.VCDPropertyItems.FindInterface( VCDID_Exposure + ":" +_
                                                                    VCDElement_Value + ":" + _
                                                                 VCDInterface_AbsoluteValue )

If Not AbsValItf Is Nothing Then
    ' Interface successfully retrieved ...
Else
    ' There is no absolute value interface for the value element
    ' of the exposure property item.
End If

If the absolute values interface does not exist for this property, we try to retrieve the map strings interface ( VCDMapStringsProperty, GUID: VCDInterface_MapStrings). It is not as accurate as the absolute values interface, but it provides a meaning for the value. The following code retrieves the map strings interface for the value element of the exposure property item:

' Declare a map strings interface
Dim MapStringsItf As VCDMapStringsProperty

' Retrieve a map strings interface for exposure
Set MapStringsItf = ICImagingControl1.VCDPropertyItems.FindInterface( VCDID_Exposure + ":" + _
                                                                    VCDElement_Value + ":" + _
                                                                 VCDInterface_MapStrings )

If Not MapStringsItf Is Nothing Then
    ' Interface successfully retrieved ...
Else
    ' There is no map strings interface for the value element
    ' of the exposure property item.
End If

If the map strings interface does not exist for this property, we try to retrieve the range interface ( VCDRangeProperty, GUID: VCDInterface_Range). This interface does not provide a meaning for the value, but it may provide more values than the map strings interface. The following code retrieves the range interface for the value element of the exposure property item:

' Declare a range interface
Dim RangeItf As VCDRangeProperty

' Retrieve a range interface for exposure
Set RangeItf = ICImagingControl1.VCDPropertyItems.FindInterface( VCDID_Exposure + ":" + _
                                                                    VCDElement_Value + ":" + _
                                                                 VCDInterface_Range )

If Not RangeItf Is Nothing Then
    ' Interface successfully retrieved ...
Else
    ' There is no range interface for the value element
    ' of the exposure property item.
End If

Using Interfaces

In the previous section we learned how to get an interface. Now we will discuss how use them in order to get information about the property and manipulate the value. All interfaces provide the following properties:

  • Available: Indicates whether this interface is currently available. For example, interfaces for the trigger property item may not be available while the image stream is running.
  • ReadOnly: Indicates whether a value may be assigned to the Value of the interface.
  • Default: Is the default value.
  • Value: The Value of the interface.

The absolute values and the range interface provide properties to get information about the minimum, maximum value that can be assigned to the actual value. The absolute values interface provides additional information about the physical dimension of the value. The map strings interface provides a collection of strings, which build the set of possible values that may be assigned to the actual value.

If the absolute values interface could be retrieved, the code for accessing the interface looks as follows:

' AbsValItf is a valid absolute value interface for exposure
If AbsValItf.Available Then
    ' Set the current value to the average
    AbsValItf.Value = ( AbsValItf.RangeMin + AbsValItf.RangeMax ) / 2
End If

If the map strings interface could be retrieved, the code for accessing the interface looks as follows:

' MapStringsItf is a valid map string interface for exposure
If MapStringsItf.Available Then
    ' Set the current value to the average
    MapStringsItf.Value = ( MapStringsItf.RangeMin + MapStringsItf.RangeMax ) / 2
End If

If only the range interface could be retrieved, the code for accessing the interface looks as follows:

' RangeItf is a valid range interface for exposure
If RangeItf.Available Then
    ' Set the current value to the average
    RangeItf.Value = ( RangeItf.RangeMin + RangeItf.RangeMax ) / 2
End If

Serialization of property values

The VCDPropertyItems collection provides a method called VCDPropertyItems.Save that serializes the current state of all VCD properties of the currently selected device into a string. The property values are stored in XML format. Therefore, it is easy to store the string in the registry or a file for later restore operations. Please note that the XML representation is not documented and may change without notice. The method for restoring all property values is called VCDPropertyItems.Load.

<< Technical Articles


DCAMprop DLL

The DCAM Prop DLL that provided access to special DCAM properties in version 1.41 is not needed anymore, because these special properties can now be accessed and manipulated using the new VCD properties. This document describes alternatives for all functions and procedures of the DCAM Prop DLL.

IsPhysicalUnits%%%, SetPhysicalUnits%%%

If physical units are supported for the property %%%, the appropriate VCD property provides a map strings interface ( VCDMapStringsProperty ). It might be necessary to activate physical units support for a specific device explicitly by a special driver setup. Please refer to the device documentation for details. There is a new interface called absolute value ( VCDAbsoluteValueProperty ). Like the physical units of the map strings interface, it provides a meaning for the values. In addition, it provides a high resolution. Therefore, you should use the absolute values interface, if supported.

IsWhiteBalance%%%, GetWhiteBalace%%%, SetWhiteBalance%%%

Basically there are two ways to handle these functions. The first one is to use the VCDSimpleProperty class. The usage of this class is described in the Using the VCD Simple Property Class chapter of the user's guide. The helper class offers methods to set and retrieve property values and to check the availability of a certain property. Every method of this helper class needs an ID that specifies the property for which the method is to be called. The IDs for "WhiteBalanceBlue" and "WhiteBalanceRed" are VCDElement_WhiteBalanceBlue and VCDElement_WhiteBalanceRed. For detailed information, please refer to the VCDSimpleProperty class.

The second way is to directly use the new VCDProperties. The chapters Basic Use of VCD Properties and List VCD Properties of the user's guide show you how to use them. When using the new VCDProperties, it is important to know how they are organized. There are VCDPropertyItems, VCDPropertyElements and VCDPropertyInterfaces. Each item has one or more elements and each element has one ore more interfaces. The interfaces allow the related property elements to be manipulated. In order to check, whether "WhiteBalance%%%" is available, use the VCDPropertyItems.FindElement method with VCDID_WhiteBalance + ":" + VCDElement_WhiteBalance%%% as a parameter. VCDID_WhiteBalance describes the property item, while VCDElement_WhiteBalance%%% describes the element "WhiteBalanceRed" or "WhiteBalanceBlue". If the property is supported, the respective element is returned. If it is not supported, Nothing is returned.

To get or set the values for "WhiteBalance%%%", retrieve the appropriate interface with the VCDPropertyItems.FindInterface, VCDPropertyElement.FindInterface or VCDPropertyElements.FindInterface method. As soon as the interface is retrieved, its methods can be used to manipulate the property. For detailed information, please refer to VCDPropertyInterface.

' Declare a range interface
Dim Range As VCDRangeProperty

' Retrieve a range interface for WhiteBalanceRed
Set Range = ICImagingControl1.VCDPropertyItems.FindInterface( VCDID_WhiteBalance + ":" + _
                                                                    VCDElement_WhiteBalanceRed + ":" + _
                                                                 VCDInterface_Range )

' Initialize a slider sldWhiteBalanceRed with the values of the WhiteBalanceRed property
If Not Range Is Nothing Then
    sldWhiteBalanceRed.Min = Range.RangeMin
    sldWhiteBalanceRed.Max = Range.RangeMax
    sldWhiteBalanceRed.Value = Range.Value
    sldWhiteBalanceRed.Enabled = True
Else
    sldWhiteBalanceRed.Enabled = False
End If

IsHorizontalFlipAvailable, GetHorizontalFlip, SetHorizontalFlip

To check whether the horizontal flip is available, use the DeviceFlipHorizontalAvailable property. To get or set the horizontal flip, the DeviceFlipHorizontal property is used.

<< Technical Articles


Reference

Complete list of all classes and functions.

Constants

Complete list of all constants.

Helper Classes

Complete list of Helper Classes.

Modules

Complete list of additional modules for Visual Basic™.

Classes

This page provides a complete list of IC Imaging Control's classes and its properties, methods and events sorted in alphabetical order.

Enumerations

Complete list of all enumerations.

<< IC Imaging Control ActiveX User's Guide


Constants

Complete list of all constants.

Constants

Constant | Description
Standard Element Identifier Strings | The Standard Element Identifier Strings are used to find a VCDPropertyElement of a VCDPropertyItem.
Standard Interface Identifier Strings | The Standard Interface Identifier Strings are used to find interface objects of a VCDPropertyElement.
Standard Property Item Identifier Strings | The Standard Property Item Identifier Strings are used to retrieve a VCDPropertyItem from the VCDPropertyItems collection. The strings are passed to the VCDPropertyItems.FindItem method.

<< Reference


constants::Standard Element Identifier Strings

constants.Standard Element Identifier Strings
The Standard Element Identifier Strings are used to find a VCDPropertyElement of a VCDPropertyItem.
After a VCDPropertyItem object has been retrieved with one of the Standard Property Item Identifier Strings, the property elements of the property item can be retrieved.
The strings are passed to the VCDPropertyElement.FindInterface method. The element type is used to retrieve a sub property of a camera property. For example the exposure camera property can have a value and an auto element. The value element is used to retrieve and set an value (e.g. 114). The auto element is used to enable or disable automation for exposure. An interface to an element is retrieved by adding a string from the Standard Interface Identifier Strings to the Standard Element Identifier String.
The Standard Element Identifier Strings are declared in the module VCDPropertyID.bas. This module is located in the samples\vb6\Common directory of the IC Imaging Control installation directory. To use the strings, the module file VCDPropertyID.bas must be added to the project.
The Basic Use of VCD Properties article in the Programmer's Guide shows how to use the element identifier strings.
Constant | Description
VCDElement_Value | Finds a value element with minimum and maximum.
VCDElement_Auto | Finds an auto element for enable or disable automation of a property.
VCDElement_OnePush | Finds a button element like the white balance OnePush.
VCDElement_ResetValue | Retrieves the reset value element.
VCDElement_WhiteBalanceBlue | Retrieves the white balance blue element of DCAM cameras.
VCDElement_WhiteBalanceRed | Retrieves the white balance red element of DCAM cameras.
VCDElement_AutoReference | Retrieves the auto reference value for the exposure element of the Dxx 21F04 camera series.
VCDElement_TriggerPolarity | Retrieves the trigger polarity element.
VCDElement_TriggerMode | Retrieves the trigger mode element.
VCDElement_MultiSlope_SlopeValue0 | Retrieves the multi slope 0 value element.
VCDElement_MultiSlope_ResetValue0 | Retrieves the multi slope reset 1 value element.
VCDElement_MultiSlope_SlopeValue1 | Retrieves the multi slope 1 value element.
VCDElement_MultiSlope_ResetValue1 | Retrieves the multi slope reset 1 value element.
VCDElement_MultiSlope_SlopeValue2 | Retrieves the multi slope 2 value element.
VCDElement_MultiSlope_ResetValue2 | Retrieves the multi slope reset 3 value element.
VCDElement_MultiSlope_SlopeValue3 | Retrieves the multi slope 3 value element.
VCDElement_MultiSlope_ResetValue3 | Retrieves the multi slope reset 3 value element.
VCDElement_MultiSlope_SlopeValue4 | Retrieves the multi slope 4 value element.
VCDElement_MultiSlope_ResetValue4 | Retrieves the multi slope reset 4 value element.
VCDElement_MultiSlope_SlopeValue5 | Retrieves the multi slope 5 value element.
VCDElement_MultiSlope_ResetValue5 | Retrieves the multi slope reset 5 value element.
VCDElement_MultiSlope_SlopeValue6 | Retrieves the multi slope 6 value element.
VCDElement_MultiSlope_ResetValue6 | Retrieves the multi slope reset 6 value element.
VCDElement_MultiSlope_SlopeValue7 | Retrieves the multi slope 7 value element.
VCDElement_MultiSlope_ResetValue7 | Retrieves the multi slope reset 7 value element.

<< Constants


constants::Standard Interface Identifier Strings

constants.Standard Interface Identifier Strings
The Standard Interface Identifier Strings are used to find interface objects of a VCDPropertyElement.
The interface of a VCDPropertyElement determines the handling of the regared property element. For example an auto element should be handled by a switch interface. These strings are combined with a string from the Standard Element Identifier Strings. The resulting string is passed to the VCDPropertyElement.FindInterface method.
The Standard Interface Identifier Strings are declared in the module VCDPropertyID.bas. This module is located in the samples\vb6\Common directory of the IC Imaging Control installation directory. To use the strings, the module file VCDPropertyID.bas must be added to the project.
The Basic Use of VCD Properties article in the Programmer's Guide shows how to use the interface identifier strings.
Constant | Description
VCDInterface_Range | Finds a VCDRangeProperty.
VCDInterface_Switch | Finds a VCDSwitchProperty.
VCDInterface_Button | Finds a VCDButtonProperty.
VCDInterface_MapStrings | Finds a VCDMapStringsProperty.
VCDInterface_AbsoluteValue | Finds a VCDAbsoluteValueProperty.

<< Constants


constants::Standard Property Item Identifier Strings

constants.Standard Property Item Identifier Strings
The Standard Property Item Identifier Strings are used to retrieve a VCDPropertyItem from the VCDPropertyItems collection. The strings are passed to the VCDPropertyItems.FindItem method.
A Standard Property Item Identifier String can be combined with a string from the Standard Element Identifier Strings and a string from the Standard Interface Identifier Strings. The strings are separeted by a colon. The resulting string can be passed to the VCDPropertyItems.FindItem method to retrieve an interface to the specified property.
The Standard Property Item Identifier Strings are declared in the module VCDPropertyID.bas. This module is located in the samples\vb6\Common directory of the IC Imaging Control installation directory. To use the strings, the module file VCDPropertyID.bas must be added to the project.
The Basic Use of VCD Properties article in the Programmer's Guide shows how to use the property item identifier strings.
Constant | Description
VCDID_Brightness | Retrieves the brightness property item.
VCDID_Contrast | Retrieves the contrast property item.
VCDID_Hue | Retrieves the hue property item.
VCDID_Saturation | Retrieves the saturation property item.
VCDID_Sharpness | Retrieves the sharpness property item.
VCDID_Gamma | Retrieves the gamma property item.
VCDID_ColorEnable | Retrieves the color enable property item.
VCDID_WhiteBalance | Retrieves the white balance property item.
VCDID_BacklightCompensation | Retrieves the backlight compensation property item.
VCDID_Gain | Retrieves the gain property item.
VCDID_Pan | Retrieves the pan property item.
VCDID_Tilt | Retrieves the tilt property item.
VCDID_Roll | Retrieves the roll property item.
VCDID_Zoom | Retrieves the zoom property item.
VCDID_Exposure | Retrieves the exposure property item.
VCDID_Iris | Retrieves the iris property item.
VCDID_Focus | Retrieves the focus property item.
VCDID_VCRCompatibilityMode | Retrieves the VCR compatibility mode property item.
VCDID_AutoReference | Retrieves the auto reference value for the exposure property item of the Dxx 21F04 camera series.
VCDID_TriggerPolarity | Retrieves the trigger polarity property item.
VCDID_Trigger | Retrieves the trigger mode property item.
VCDID_TestPattern | Retrieves the test pattern property of the Dxx 21F04 camera series
VCDID_MultiSlope | Retrieves the multi slope property item.

<< Constants


Helper Classes

Complete list of Helper Classes.

VCDSimpleProperty

This class wraps the concept of VCDProperties to make them easier to use.

<< Reference


Modules

Complete list of additional modules for Visual Basic™.

VCDPropertyIDs

This module contains the strings to be passed to the FindItem and FindInterface methods of the VCDProperty classes.

VCDSimpleModule

This module contains helper functions for the VCDSimpleProperty helper class.

<< Reference


VCDPropertyIDs

This module contains the strings to be passed to the FindItem and FindInterface methods of the VCDProperty classes.

File

The module VCDPropertyID.bas is located in the Common directory in samples\vb6 of the IC Imaging Control installation directory.

To use the module in your own projects, you have to add the module file VCDPropertyID.bas to your project.

The module contains following string types:

Standard Property Item Identifier Strings

Standard Element Identifier Strings

Standard Interface Identifier Strings

Sample

The Basic Use of VCD Properties article in the Programmer's Guide shows how to use the property item identifier strings.

<< Modules


VCDSimpleModule

This module contains helper functions for the VCDSimpleProperty helper class.

File

The module VCDSimpleModule.bas is located in the Common directory in samples\vb6 of the IC Imaging Control installation directory.

To use the module in your own projects, you have to add the module file VCDSimpleModule.bas to your project.

<< Modules


Classes

This page provides a complete list of IC Imaging Control's classes and its properties, methods and events sorted in alphabetical order.

AviCompressor

An AviCompressor object represents an avi compressor (codec). The properties of an avi compressor can be altered by displaying its property dialog.

AviCompressors

AviCompressors is a collection of AviCompressor objects. An AviCompressors collection is used to obtain a list of available avi compressors (codecs). The ICImagingControl.AviCompressors property returns an AviCompressors collection.

BSTRCollection

This class is a collection of strings.

BaseSink

This class represents a generic sink and provides properties and methods that all sinks have in common. A BaseSink can hold either a FrameHandlerSink or a MediaStreamSink. A FrameHandlerSink is used to access individual frames out of the image stream, while MediaStreamSink writes the image stream to a media file.

Device

A Device object contains the information about a video capture device. The Name property of this object is used to set the ICImagingControl.Device property. This sets the current video capture device. A Device can be obtained out of the Devices collection.

DeviceFrameRates

DeviceFrameRates is a collection of frame rates supported by a video capture device. The ICImagingControl.DeviceFrameRates property returns a DeviceFrameRates collection.

Devices

Devices is a collection of Device objects. The Devices collection contains all currently available devices. The ICImagingControl.Devices property returns a Devices collection.

FrameFilter

FrameFilter is the class provides the interface to a filter that was loaded from a filter module. It contains methods to access the filter's parameters, display a configuration dialog and save filter settings.

FrameFilterInfo

A FrameFilterInfo object contains information about a frame filter that can be loaded from a frame filter module and instantiated, using ICImagingControl.FrameFilterCreate.

FrameFilterInfos

The FrameFilterInfos class contains FrameFilterInfo objectsm describing frame filters that can be loaded from an existing module.

FrameFilters

The FrameFilters class represents a chain of FrameFilter objects, that are used to transform the image data along the Device Path, Sink Path and Display Path.

FrameHandlerSink

The FrameHandlerSink is the SinkType used to grab (copy) frames from the image stream. It contains an ImageBuffer collection and optionally allows you to specify one or more FrameFilters that are responsible for copying the image data to the ImageBuffers. The FrameFilter implementation can perform user-defined transformations while copying the data, and they can intentionally drop unwanted frames. If no frame filter is registered, the frames are copied to the ImageBuffer collection without being changed.

FrameType

A FrameType describes the color format and (optionally) dimensions and buffer size of the image format of ImageBuffer objects.

FrameTypes

The FrameTypes collection is used to define a list of FrameTypes. A FrameTypes collection is used, i.e. to determine which FrameTypes are accepted by a frame filter or a sink.

ICImagingControl

The ICImagingControl object provides the main functionality of this library. It enables you to select and set up devices, control image acquisition and manage image buffers and image streams.

ImageBuffer

An ImageBuffer object contains the image data of one frame. IC Imaging Control's internal ring buffer consists of ImageBuffers.

ImageBuffers

ImageBuffers is a collection of ImageBuffer objects. It represents the ring buffer used internally by Imaging Control. The ICImagingControl.ImageBuffers property returns an ImageBuffers collection.

InputChannel

An InputChannel object contains the information about an analog input channel that is available on the current video capture device.

InputChannels

InputChannels is a collection of InputChannel objects. A InputChannels collection is used to obtain the available input channels of the current video capture device. The ICImagingControl.InputChannels property returns a InputChannels collection.

MediaStreamContainer

A MediaStreamContainer describes a video file format. The most common video file format is AVI.

MediaStreamContainers

MediaStreamContainers is a collection of MediaStreamContainer objects. The collection contains all available media stream containers. The ICImagingControl.MediaStreamContainers property returns a MediaStreamContainers collection.

MediaStreamSink

The MediaStreamSink allows video files to be recorded in a more sophisticated manor than is possible using AviStartCapture and AviStopCapture. However, for simple tasks, the methods AviStartCapture and AviStopCapture are better suited, as they are really easy to use. A MediaStreamSink can save image data to video files in various formats and optionally allows you to specify one or more FrameFilters that can analyze and/or transform the image data, before it is written to the video file.

OverlayBitmap

An OverlayBitmap object contains the overlay data, methods and properties for drawing text and graphics on the live video stream.

VCDAbsoluteValueProperty

This class represents an absolute value interface to a value of a video capture device property.

VCDButtonProperty

This class represents a button interface to a video capture device property. Button interfaces allow invoking an operation at the property.

VCDCategoryMap

This class describes how items are organized in categories.

VCDMapStringsProperty

This class represents an interface to a value of a video capture device property, that uses names for the values.

VCDPropertyElement

This class represents an element of video capture device property.

VCDPropertyElements

This class is a collection of VCDPropertyElement objects.

VCDPropertyInterface

This class represents an interface to a value of a video capture device property. It is an abstract base class for several more specialized interfaces.

VCDPropertyItem

A VCDPropertyItem object provides the functionality to access a video capture device property.

VCDPropertyItems

This class contains a collection of all VCDPropertyItem objects that are supported by the currently opened device.

VCDRangeProperty

This class represents a range interface to a value of a video capture device property.

VCDSwitchProperty

This class represents a switch interface to a value of a video capture device property. A switch interface is used to enable or disable settings of a property.

VideoFormat

A VideoFormat object contains information about a video format supported by the current video capture device.

VideoFormats

VideoFormats is a collection of VideoFormat objects. A VideoFormats collection is used to obtain the available video formats of the current video capture device. The ICImagingControl.VideoFormats property returns a VideoFormats collection.

VideoNorm

A VideoNorm object contains information about a video norm supported by the current video capture device.

VideoNorms

VideoNorms is a collection of VideoNorm objects. A VideoNorms collection is used to obtain the available video norms of the current video capture device. The ICImagingControl.VideoNorms property returns a VideoNorms collection.

<< Reference


AviCompressor

An AviCompressor object represents an avi compressor (codec). The properties of an avi compressor can be altered by displaying its property dialog.

An AviCompressor can be obtained out of the AviCompressors collection.

Example

Dim AviComp As AviCompressor
Set AviComp = ICImagingControl1.AviCompressors.Item( 1 )

Information

Introduced in IC Imaging Control 1.x

Properties

Property | Description
CompressorData | Returns or sets the data of an AviCompressor.
CompressorDataSize | Returns the size of the SAFEARRAY of Byte returned by CompressorData.
Name | Returns the name of the AviCompressor
PropertyPageAvailable | Returns True, if the AviCompressor has a property page, otherwise False.

Methods

Method | Description
ShowPropertyPage | Shows the property page of the AviCompressor, if available. If a property page is not available, an error is returned.

<< Classes


AviCompressor::CompressorData

AviCompressor.CompressorData Property
Returns or sets the data of an AviCompressor.
Syntax:
Public CompressorData As Variant
Remarks:

The returned data should only be used to store the state of the codecs. The data in the array is not to be modified. If inconsistent data is passed to the codec, an error is returned. Furthermore, the data of one codec will not match each other.

Sample:

The following example shows how to save and load codec data into and from a binary file. The codec which is currently used, must be declared globally. If it is declared locally in the sub procedure, it would loose its settings after exiting the sub procedure, because it would be removed from memory. The complete example can be found in the samples directory in Saving Codec Properties.

' Global declaration of the AviCompressor object
Dim Codec As AviCompressor

Save the data from a codec that was selected in a combo box.

Private Sub cmdSaveData_Click()
    Dim Data() As Byte ' Dynamic array for the data stream.

    Open "test.bin" For Binary As #1 ' Must be opened binary!

    ' Save the length of the codec's name.
    Put #1, , Len(Codec.Name)

    ' Save the name of the codec.
    Put #1, , Codec.Name

    ' Save the byte count of the data stream. It is used
    ' when data is loaded from file to resize the dynamic array.
    Put #1, , Codec.CompressorDataSize

    ' Get the data from the codec.
    Data = Codec.CompressorData

    ' Save the data to the file.
    Put #1, , Data
    Close #1
End Sub

Load the previously saved data and assign it to a codec.

Private Sub cmdLoadData_Click()
    Dim Data() As Byte      ' Dynamic array for the data stream.
    Dim Length As Long      ' Length of the data stream.
    Dim NameLength As Long  ' Length of the codec's name.
    Dim CodecName As String ' Name of the codec.
    Dim i As Integer

    Open "test.bin" For Binary As #1 ' Must be opened binary!

    ' Read the length of the codec's name.
    Get #1, , NameLength

    ' Allocate memory for the name.
    CodecName = String(NameLength, " ")

    ' Read the name of the codec.
    Get #1, , CodecName

    ' Compare the names.
    If CodecName = Codec.Name Then
        ' Read the length of the follwing data.
        Get #1, , Length

        ' Resize the data array to Length.
        ReDim Data(Length)

        ' Read the codec data from the file.
        Get #1, , Data

        ' Assign the read data to the codec object.
        Codec.CompressorData = Data
    Else
        MsgBox "The saved data does not match to the used codec." + Chr(13) + _
               "saved: " + CodecName + Chr(13) + _
               "used: " + Codec.Name
    End If
    Close #1
End Sub
See Also: AviCompressor, AviCompressor.CompressorDataSize

<< AviCompressor


AviCompressor::CompressorDataSize

AviCompressor.CompressorDataSize Property
Returns the size of the SAFEARRAY of Byte returned by CompressorData.
Syntax:
Public CompressorDataSize As Long
Limitations:

Read only.
Remarks:

The CompressorDataSize is useful, if codec properties are to be saved to a file. Reading the size value first from file, enables an application to create an array of the matching size that will get the codec properties.

Sample:

How to use the CompressorDataSize is shown in the sample Saving Codec Properties.

' Global declaration of the AviCompressr object
Dim Codec As AviCompressor

Save the data from a codec that was selected in a combo box.

Private Sub cmdSaveData_Click()
    Dim Data() As Byte ' Dynamic array for the data stream.

    Open "test.bin" For Binary As #1 ' Must be opened binary!

    ' Save the length of the codec's name.
    Put #1, , Len(Codec.Name)

    ' Save the name of the codec.
    Put #1, , Codec.Name

    ' Save the byte count of the data stream. It is used
    ' when data is loaded from file to resize the dynamic array.
    Put #1, , Codec.CompressorDataSize

    ' Get the data from the codec.
    Data = Codec.CompressorData

    ' Save the data to the file.
    Put #1, , Data
    Close #1
End Sub

Load the previously saved data and assign it to a codec.

Private Sub cmdLoadData_Click()
    Dim Data() As Byte      ' Dynamic array for the data stream.
    Dim Length As Long      ' Length of the data stream.
    Dim NameLength As Long  ' Length of the codec's name.
    Dim CodecName As String ' Name of the codec.
    Dim i As Integer

    Open "test.bin" For Binary As #1 ' Must be opened binary!

    ' Read the length of the codec's name.
    Get #1, , NameLength

    ' Allocate memory for the name.
    CodecName = String(NameLength, " ")

    ' Read the name of the codec.
    Get #1, , CodecName

    ' Compare the names.
    If CodecName = Codec.Name Then
        ' Read the length of the follwing data.
        Get #1, , Length

        ' Resize the data array to Length.
        ReDim Data(Length)

        ' Read the codec data from the file.
        Get #1, , Data

        ' Assign the read data to the codec object.
        Codec.CompressorData = Data
    Else
        MsgBox "The saved data does not match to the used codec." + Chr(13) + _
               "saved: " + CodecName + Chr(13) + _
               "used: " + Codec.Name
    End If
    Close #1
End Sub
See Also: AviCompressor, AviCompressor.CompressorData

<< AviCompressor


AviCompressor::Name

AviCompressor.Name Property
Returns the name of the AviCompressor
Syntax:
Public Name As String
Limitations:

Read only.
Sample:

This example starts an avi capture with the first compressor in the collection:

Dim AviComp As AviCompressor ' Create the AviCompressor object
' Get the first available AviCompressor
Set AviComp = ICImagingControl1.AviCompressors.Item( 1 )
' Start capturing with the target file and the name of the
' AviCompressor selected previously
ICImagingControl1.AviStartCapture "test.avi", AviComp.Name

How to use avi compressors is shown in the Capturing an AVI File sample.

See Also: AviCompressor, AviCompressors Collection

<< AviCompressor


AviCompressor::PropertyPageAvailable

AviCompressor.PropertyPageAvailable Property
Returns True, if the AviCompressor has a property page, otherwise False.
Syntax:
Public PropertyPageAvailable As Boolean
Limitations:

Read only.
Sample:

This example shows how to enable/disable a button that calls the property page of the first avi compressor:

Dim AviComp As AviCompressor
Set AviComp = ICImagingControl1.AviCompressors.Item( 1 )
cmdShowPropertyPage.Enabled = AviComp.PropertyPageAvailable

How to use avi compressors is shown in the Capturing an AVI File sample.

See Also: AviCompressor, AviCompressor.ShowPropertyPage, AviCompressors Collection

<< AviCompressor


AviCompressor::ShowPropertyPage

AviCompressor.ShowPropertyPage Method
Shows the property page of the AviCompressor, if available. If a property page is not available, an error is returned.
Syntax:
Public Sub ShowProperyPage
Sample:

This example shows how to display the property page of the avi compressor (codec) that is currently selected in a combo box:

Dim AviComp As AviCompressor
Set AviComp = ICImagingControl1.AviCompressors.Item( 1 )

If AviComp.PropertyPageAvailable Then
    AviComp.ShowPropertyPage
Else
    ' avi compressor has no property page
End If

How to use avi compressors is shown in the Capturing an AVI File sample.

See Also: AviCompressor, AviCompressors Collection, AviCompressor.PropertyPageAvailable

<< AviCompressor


AviCompressors

AviCompressors is a collection of AviCompressor objects. An AviCompressors collection is used to obtain a list of available avi compressors (codecs). The ICImagingControl.AviCompressors property returns an AviCompressors collection.

Example

This example shows how to fill a combo box with all available avi compressors.

Dim AviCompCol As AviCompressors
Dim AviComp As AviCompressor
Set AviCompCol = ICImagingControl1.AviCompressors

For Each AviComp In AviCompCol
    cboAviCompressorComboBox.AddItem AviComp.Name
Next

Properties

Property | Description
Count | Returns the count of AviCompressor objects in the collection.
Item | Returns the AviCompressor at the specified position.

Methods

Method | Description
FindIndex | Searches the collection for a given string. The string contains the name of a codec.

<< Classes


AviCompressors::Count

AviCompressors.Count Property
Returns the count of AviCompressor objects in the collection.
Syntax:
Public Count As Long
Limitations:

Read only.
Remarks:

How to use AVI compressors is shown in the Capturing an AVI File sample.

Sample:

This example determines whether one or more AVI compressors is available.

Dim AviCompCol As AviCompressors
Set AviCompCol = ICImagingControl1.AviCompressors
If AviCompCol.Count > 0 Then
    ' do something
Else
    ' no AVI compressors available
End If
See also: AviCompressors, AviCompressor, AviCompressors.Item, AviCompressors.FindIndex

<< AviCompressors


AviCompressors::Item

AviCompressors.Item Property
Returns the AviCompressor at the specified position.
Syntax:
Public Item(Index As Long) As AviCompressor
Limitations:

Read only.
Remarks:

How to use avi compressors is shown in the Capturing an AVI File sample.

Sample:

This example selects the first available AVI compressor and shows its property page.

Dim AviCompCol As AviCompressors
Set AviCompCol = ICImagingControl1.AviCompressors
AviCompCol.Item( 1 ).ShowPropertyPage
See also: AviCompressors, AviCompressor, AviCompressors.Count, AviCompressors.FindIndex

<< AviCompressors


AviCompressors::FindIndex

AviCompressors.FindIndex Method
Searches the collection for a given string. The string contains the name of a codec.
Syntax:
Public Function FindIndex(Name As String) As Long

Parameter | Description
Name | Specifies the name of the codec for which to search in the collection.
Return Value:

If the property Name of an AviCompressor object is equal to the given string, the FindIndex method returns the index of this object in the collection. If the string is not found, the FindIndex method returns -1.

Remarks:

How to use avi compressors is shown in the Capturing an AVI File sample.

Sample:

This example checks whether the "DV Video Encoder" avi compressor is available.

Dim AviCompCol As AviCompressors
Dim Index As long
Set AviCompCol = ICImagingControl1.AviCompressors
Index = AviCompCol.FindIndex("DV Video Encoder")
If Index = -1 Then
    ' avicompressor not available
Else
    ' do something
End If
See also: AviCompressors, AviCompressor, AviCompressors.Count, AviCompressors.Item

<< AviCompressors


Device

A Device object contains the information about a video capture device. The Name property of this object is used to set the ICImagingControl.Device property. This sets the current video capture device. A Device can be obtained out of the Devices collection.

Example

The following example shows how to get the first available device object.

Dim dev As Device
dev = ICImagingControl1.Devices(1)

Information

Introduced in IC Imaging Control 1.x

Properties

Property | Description
Name | Returns the name of the Device.

Methods

Method | Description
GetSerialNumber | Retrieves the serial number of the video capture device.

<< Classes


Device::Name

Device.Name Property
Returns the name of the Device.
Syntax:
Public Name As String
Limitations:

Read only.
Sample:

This example selects the first available device.

Private Sub Form_Load()
    Dim Dev As Device

    Set Dev = ICImagingControl1.Devices.Item( 1 )
    ICImagingControl1.Device = Dev.Name
End
See also: Device, Devices

<< Device


Device::GetSerialNumber

Device.GetSerialNumber Method
Retrieves the serial number of the video capture device.
Syntax:
Public Function GetSerialNumber( Number As String ) As Boolean

Parameter | Description
Number | Specifies the string that will receive the serial number.
Return Value:

True, if the serial number of the video capture device could be retrieved. If the video capture device does not support serial numbers, False is returned.

Limitations:

Runtime only.
Sample:

This example demonstrates how to use the GetSerialNumber method.

Private Sub GetSerialNumber(SerialNumber As String)
    Dim SN As String
    Dim Dev As Device

    ' Get the first video capture device
    Set Dev = ICImagingControl1.Devices.Item(1)

    ' Check, whether a serial number can be retrieved
    If Dev.GetSerialNumber(SN) = True Then
        SerialNumber = SN
    Else
        SerialNumber = "n/a"
    End If
End Sub
See also: Device, Devices

<< Device


DeviceFrameRates

DeviceFrameRates is a collection of frame rates supported by a video capture device. The ICImagingControl.DeviceFrameRates property returns a DeviceFrameRates collection.

Example

This example shows how to fill a combo box with the available frame rates:

Dim FrameRateCol As DeviceFrameRates ' Declare the collection
Dim Rate As Variant                  ' Used as item in For Each...

Set FrameRateCol = ICImagingControl1.DeviceFrameRates

' Insert the frame rates in a combo box
For Each Rate In FrameRateCol
    cboFramerateComboBox.AddItem Str(Rate)
Next

Properties

Property | Description
Count | Returns the number of frame rates in the collection.
Item | Returns the frame rate at the given position.

Methods

Method | Description
FindIndex | Returns the index of the supplied frame in the collection.

<< Classes


DeviceFrameRates::Count

DeviceFrameRates.Count Property
Returns the number of frame rates in the collection.
Syntax:
Public Count As Long
Limitations:

Read only.
Sample:

This example determines whether frame rates are available:

Dim RateCol As DeviceFrameRates
Set RateCol = ICImagingControl1.DeviceFrameRates
If RateCol.Count > 0 then
    ' Do something.
else
    ' No frame rates available.
End If
End Sub
See also: DeviceFrameRates, DeviceFrameRates.Item

<< DeviceFrameRates


DeviceFrameRates::Item

DeviceFrameRates.Item Property
Returns the frame rate at the given position.
Syntax:
Public Item(Index As Long) As Single

Parameter | Description
Index | Specifies the Index of the rate to return. The Index must lie in the range [1, DeviceFrameRates.Count ], otherwise an error occurs.
Limitations:

Read only.
Sample:

This example selects a frame rate:

Private Sub lstFrameRateList_Click()
    Dim SelectedRate As Integer
    Dim DevFrameRateCol As DeviceFrameRates

    ' Get the DeviceFrameRates collection from ICImagingControl.
    Set DevFrameRateCol = ICImagingControl1.DeviceFrameRates

    ' Get the selected frame rate from the combo box.
    SelectedRate = lstFrameRateList.ListIndex + 1

    ' Stop the grabber before setting the new frame rate.
    cmdStopLive_Click

    ' Now set the new frame rate.
    ICImagingControl1.DeviceFrameRate = DevFrameRateCol.Item(SelectedRate)

End Sub
See also: DeviceFrameRates, DeviceFrameRates.Count

<< DeviceFrameRates


DeviceFrameRates::FindIndex

DeviceFrameRates.FindIndex Method
Returns the index of the supplied frame in the collection.
Syntax:
Public Function FindIndex( Rate As Single ) As Long

Parameter | Description
Rate | Specifies the frame rate of the video capture device for which to search in the collection.
Return Value:

If the returned frame rate of the property DeviceFrameRates.Item is identical to the given single value, the FindIndex method returns the index of this frame rate in the collection. If the single frame rate is not found, the FindIndex method returns -1.

See also: DeviceFrameRates, DeviceFrameRates.Count, DeviceFrameRates.Item

<< DeviceFrameRates


Devices

Devices is a collection of Device objects. The Devices collection contains all currently available devices. The ICImagingControl.Devices property returns a Devices collection.

Example

This example shows how to fill a combo box with the available devices :

Dim DevCol As Devices
Dim Dev As Device
Set DevCol = ICImagingControl1.Devices

For Each Dev In DevCol
    cboDeviceComboBox.AddItem Dev.Name
Next

Properties

Property | Description
Count | Returns the count of Device objects in the collection.
Item | Returns the Device at the specified position.

Methods

Method | Description
FindIndex | Searches the collection for a given string. The string contains the name of a device.

<< Classes


Devices::Count

Devices.Count Property
Returns the count of Device objects in the collection.
Syntax:
Public Count As Long
Limitations:

Read only.
Example:

This Basic example determines whether devices are available:

Dim DevCol As Devices
Set DevCol = ICImagingControl1.Devices
If DevCol.Count > 0 then
    ' do something
else
    ' no devices available
End If

Selecting devices, input channels, video norms and video formats is shown in the Making Device Settings chapter.

See also: Devices, Device, Devices.Item, Devices.FindIndex

<< Devices


Devices::Item

Devices.Item Property
Returns the Device at the specified position.
Syntax:
Public Item(Index As Long) As Device

Parameter | Description
Index | Specifies the Index of the Device to return. The Index must lie in the range [1, Devices.Count ], otherwise an error occurs.
Limitations:

Read only.
Example:

This Basic example selects the first available device:

Dim DevCol As VideoFormat
Set DevCol = ICImagingControl1.Devices
ICImagingControl1.Device = DevCol.Item( 1 )

Selecting devices, input channels, video norms and video formats is shown in the Making Device Settings chapter.

See also: Devices, Device, Devices.Count, Devices.FindIndex

<< Devices


Devices::FindIndex

Devices.FindIndex Method
Searches the collection for a given string. The string contains the name of a device.
Syntax:
Public Function FindIndex(Name As String) As Long

Parameter | Description
Name | Specifies the name of the device for which to search in the collection.
Return Value:

If the property Name of a Device object is equal to the given string, the FindIndex method returns the index of this object in the collection. If the string is not found, the FindIndex method returns -1.

Example:

This Basic example tests whether the device "Video to 1394 Converter" is available:

Dim DevCol As Devices
Dim Index As long
Set DevCol = ICImagingControl1.Devices
Index = DevCol.FindIndex("Video to 1394 Converter")
If Index = -1 Then
    ' device not available
Else
    ' do something
End If

Selecting devices, input channels, video norms and video formats is shown in the Making Device Settings chapter.

See also: Devices, Device, Devices.Count, Devices.Item

<< Devices


ICImagingControl

The ICImagingControl object provides the main functionality of this library. It enables you to select and set up devices, control image acquisition and manage image buffers and image streams.

The ICImagingControl object is created by the framework when the IC Imaging Control ActiveX is inserted into a form.

Information

Introduced in IC Imaging Control 1.x

Properties

Property | Description
AviCompressors | Returns a collection of available avi compressors (video codecs).
BacklightCompensation | Returns or sets the backlight compensation value of the current video source.
Brightness | Returns or sets the brightness value of the current video source.
ColorEnable | Returns or sets the color enable value of the current video source.
Contrast | Returns or sets the contrast value of the current video source.
DeBayerActive | Returns whether automatic de-bayering of BY8 image data is enabled.
DeBayerMode | This property selects the algorithm used to de-bayer BY8 image data.
DeBayerStartPattern | This property controls how the automatic de-bayering of BY8 image data should treat the pixel data.
Device | Returns or sets a video capture device. A list of all available video capture devices can be obtained using the Devices collection, which can be retrieved with a call to ICImagingControl.Devices.
DeviceCountOfFramesDropped | Returns the number dropped frames.
DeviceCountOfFramesNotDropped | Returns the number of frames that were not dropped.
DeviceCurrentActualFrameRate | Returns the frame rate currently used by the video capture device. A value of 0 indicates that this property is not supported by the video capture device.
DeviceFlipHorizontal | Returns or sets the horizontal flipping of the live video image.
DeviceFlipHorizontalAvailable | This property determines whether horizontal flip is available for the currently selected device.
DeviceFlipVertical | Returns or sets the vertical flipping of the live video image.
DeviceFlipVerticalAvailable | This property determines whether vertical flip is available for the currently selected device.
DeviceFrameFilters | The DeviceFrameFilters property provides a FrameFilters collection that contains the frame filters that are inserted in the device path.
DeviceFrameRate | Returns or sets the desired frame rate (in frames per second) of the current video capture device.
DeviceFrameRateAvailable | Returns True, if setting of frame rates is supported by the video capture device.
DeviceFrameRates | Returns a collection of frame rates supported by the video capture device. May be empty if the device does not support frame rates.
DeviceTrigger | Enables/disables external triggering of the current video capture device.
DeviceTriggerAvailable | Returns True if the device has an external trigger.
DeviceValid | Returns True when a device is open and valid, otherwise False.
Devices | Returns a collection of all available video capture devices.
DisplayFrameFilters | The DisplayFrameFilters property provides a FrameFilters collection that contains the frame filters that are inserted in the display path.
Exposure | Returns or sets the exposure value of the current video source.
ExternalTransportAvailable | Returns True if the video capture device has an external transport interface (e.g. DV-Devices).
ExternalTransportMode | Returns or sets the mode of the external transport device, if available.
Focus | Returns or sets the focus value of the current video source.
FrameFilterInfos | This property returns a list, containing FrameFilterInfo objects that describe the available frame filters, which can be loaded from frame filter modules (.ftf files).
FrameFilterPath | Sets a path from which frame filters are loaded.
Gain | Returns or sets the gain value of the current video source.
Gamma | Returns or sets the gamma value of the current video source.
Hue | Returns or sets the hue value of the current video source.
ImageActiveBuffer | Returns the ImageBuffer to which the control copied the last frame.
ImageBitsPerPixel | Returns the bits per pixel of the buffers in the control. The bytes per pixel are calculated by dividing ImageBitsPerPixel by 8. The value of this property is determined by the value of the ICImagingControl.MemoryCurrentGrabberColorformat property.
ImageBuffers | Returns a collection of ImageBuffers, which represent the buffers in the ringbuffer.
ImageHeight | Returns the image height (in pixels) of the current video source.
ImageRingBufferSize | Returns or sets the size of the internal ring buffer. Must lie in the range [1,...[.
ImageWidth | Returns the image width (in pixels) of the current video source.
InputChannel | Returns or sets the input channel of the current video capture device. Available input channels can be enumerated using the InputChannels collection, which can be retrieved with a call to ICImagingControl.InputChannels.
InputChannelAvailable | Returns True if the current video capture device supports input channels.
InputChannels | Returns a collection of available input channels for the current video capture device.
Iris | Returns or sets the iris value of the current video source.
LiveCaptureContinuous | Enables/disables the continuous capture mode. In this mode ICImagingControl.MemorySnapImage may not be called, because all frames are copied to the ring buffer automatically. After an image has been copied completely to a buffer, an ICImagingControl.ImageAvailable event is sent. If an ICImagingControl.ImageAvailable event is currently processed, a new event will not be sent.
LiveCaptureLastImage | Enables/disables the automatic call to ICImagingControl.MemorySnapImage in ICImagingControl.LiveStop. This property should be set to True if ICImagingControl is to display the last frame after LiveStop has been called.
LiveCapturePause | Returns or sets the pause for AVI capture.
LiveDisplay | Enables/disables live display in the control window. If live display is disabled, the image buffers may be shown by a call to ICImagingControl.Display.
LiveDisplayDefault | Returns or enables the use of the default size and position of the video display window.
LiveDisplayHeight | Returns or sets the height of the video display window.
LiveDisplayLeft | Returns or sets the left position of the video display window in IC Imaging Control's window.
LiveDisplayOutputHeight | Returns the actual height of the video format of the live display. Due to the use of frame filters, this height can differ from the height of the video capture device's video format and the sink's format.
LiveDisplayOutputWidth | Returns the actual width of the video format of the live display. Due to the use of frame filters, this width can differ from the width of the video capture device's video format and the sink's format.
LiveDisplayTop | Returns or sets the top position of the video display window in IC Imaging Control's window.
LiveDisplayWidth | Returns or sets the width of the video display window.
LiveDisplayZoomFactor | Returns or sets the zoom factor of the video display window.
LivePause | This property suspends and restarts the current delivery of images.
LiveShowLastBuffer | This property controls whether IC Imaging Control displays the buffer that was captured on LiveStop when LiveCaptureLastImage is enabled.
LiveVideoRunning | Indicates whether a live video is running, i.e. has been started with the LiveStart Method.
MediaStreamContainers | Returns a list containing all available MediaStreamContainers.
MemoryCurrentGrabberColorformat | Determines the color format of the image buffers in the internal ring buffer.
MemoryRingBufferSize | This property determines the size of the ring buffer that is used for the MemorySaveImageSequence and MemorySnapImageSequence methods.
MemorySnapTimeout | Returns or sets the snap timeout value. This is the time in milliseconds the functions ICImagingControl.MemorySnapImage and ICImagingControl.MemorySnapImageSequence wait until they abort.
OverlayBitmap | Returns an OverlayBitmap object.
OverlayBitmapAtPath | Returns the OverlayBitmap at a specified path position.
OverlayBitmapPosition | This property controls the positions of OverlayBitmap objects in the image stream.
OverlayUpdateEventEnable | This property is used to return or set whether the overlay update event should be called by IC Imaging Control.
Pan | Returns or sets the pan value of the current video source.
Picture | Returns a Picture object created from the data of the current buffer.
ReferenceTimeCurrent | Returns the current reference time.
ReferenceTimeStart | Returns the reference time at which the image stream was started.
Roll | Returns or sets the roll value of the current video source.
Saturation | Returns or sets the saturation value of the current video source.
ScrollBarsEnabled | Returns whether scrollbars are enabled or enables/disables scrollbars.
Sharpness | Returns or sets the sharpness value of the current video source.
SignalDetected | Returns whether a video signal is detected on the currently selected input channel of the selected video capture device.
SignalDetectedAvailable | Returns whether the current video capture device supports signal detection on its input ports.
Sink | Sets or retrieves the currently used sink. A sink is an object that receives the frames coming from the video capture device and either copies them to an ImageBuffers collection or saves them to a media stream file.
SinkCompatibilityMode | When SinkCompatibilityMode is enabled, TODO
Tilt | Returns or sets the tilt value of the current video source.
VCDPropertyItems | Returns a VCDPropertyItems collection representing the properties of the currently opened device.
VideoFormat | Returns or sets the video format of the current video capture device. A list of available video formats can be obtained using the VideoFormats collection, which can be retrieved with a call to ICImagingControl.VideoFormats.
VideoFormats | Returns a collection of available video formats for the current device and video norm.
VideoNorm | Returns or sets the video norm of the current video capture device. A list of available video norms can be obtained using the VideoNorms collection, which can be retrieved with by calling ICImagingControl.VideoNorms.
VideoNormAvailable | Returns whether the current device supports video norms.
VideoNorms | Returns a collection of available video norms for the current device.
WhiteBalance | Returns or sets the whitebalance value of the current video source.
Zoom | Returns or sets the zoom value of the current video source.
xxAuto | These properties can be used to enable the automatic setting of a feature. For instance, the BrightnessAuto property will enable the device's automatic brightness control.
xxAutoAvailable | These properties can be used to determine whether a feature is available for the currently selected device. for instance, the BrightnessAvailable property has a value of True if the Brightness property is supported.
xxAvailable | These properties can be used to determine whether a feature is available for the currently selected device. For instance, the BrightnessAvailable property has a value of True if the Brightness property is supported.
xxDefault | These properties can be used to retrieve the default value of a property for the currently selected device.
xxRange | These properties can be used to determine the valid range of values for a property. For instance, the BrightnessRange property will return the minimum and maximum brightness values supported by the selected device.

Methods

Method | Description
AviStartCapture | This method writes a compressed AVI file to the computer's hard disk.
AviStopCapture | This method stops writing an AVI file.
Display | Displays the current image buffer in IC Imaging Control's window.
DisplayImageBuffer | When the property ICImagingControl.LiveDisplay is False , then a call to ICImagingControl.DisplayImageBuffer displays the given buffer in the control window
FrameFilterCreate | Creates a new instance of a FrameFilter from a FrameFilterInfo.
FrameFilterCreateString | Creates a new instance of a FrameFilter, by specifying the filter's name.
LiveStart | This method starts the processing of images delivered by the video capture device.
LiveStop | Calling this method stops the display of a live image previously started with the LiveStart method.
LoadDeviceState | Restores the device settings saved with ICImagingControl.SaveDeviceState.
LoadDeviceStateFromFile | Restores the device settings saved with ICImagingControl.SaveDeviceStateToFile.
MemoryGetDib | This method is used to pass a Device Independent Bitmap to other programming tools for further processing.
MemoryGetImageData | Provides direct access to the image data of Imaging Control.
MemoryReleaseImageData | This method releases an image buffer that was allocated by calling the ICImagingControl.MemoryGetImageData.
MemorySaveImage | This method saves the current buffer as a .bmp file.
MemorySaveImageSequence | This method saves a sequence of images as a sequence of single .bmp files.
MemorySnapImage | This method captures a still image from a live video stream and stores it in an internal buffer. The buffer can be saved to a file using the ICImagingControl.MemorySaveImage Method.
MemorySnapImageSequence | This method captures a sequence of still images from a live video stream and stores the images in a list of internal buffers. The images can be saved to individual files using the ICImagingControl.MemorySaveImageSequence method.
SaveDeviceState | Saves the currently opened device and its settings to a string.
SaveDeviceStateToFile | Saves the currently opened device and its settings to a file.
ShowDeviceSettingsDialog | This method opens a video capture device selection dialog.
ShowPropertyDialog | This method opens a dialog to adjust all properties of the currently opened video capture device.

Events

Event | Description
DeviceLost | This event is called if the video capture device is no longer valid; for example if it was unplugged.
ImageAvailable | This event is called each time a frame has been copied completely to the internal ring buffer.
MouseDown | This event is called if the user presses a mouse button inside the control window.
MouseMove | This event is called if the user moves the mouse inside the control window.
MouseUp | This event is called if the user releases a mouse button inside the control window.
OnHScroll | This event is called after the user has scrolled the live video display horizontally.
OnVScroll | This event is called after the user scrolled the live video display vertically.
OverlayUpdate | This event is called after a new frame has been delivered by the video capture device.

<< Classes


ICImagingControl::AviCompressors

ICImagingControl.AviCompressors Property
Returns a collection of available avi compressors (video codecs).
Syntax:
Public AviCompressors As AviCompressors
Limitations:

Run time only, read only.
Sample:

This example displays all available compressors in a combo box. If no compressors are installed, the text "n/a" will be displayed in the combo box and it will be disabled. The combo box for the compessors is named "cboVideoCodec" in this example.

Private Sub Form_Load()
    Dim AviCompCollection As AviCompressors
    Set AviCompCollection = ICImagingControl1.AviCompressors
    cboVideoCodec.Clear
    If AviCompCollection.Count > 0 Then
        ' If compressors have been found, add them to the
        ' combo box.
        For Each Item In AviCompCollection
            cboVideoCodec.AddItem Item.Name
        Next
        cboVideoCodec.Enabled = True
    else
        ' No compressors have been found.
        cboVideoCodec.AddItem "n/a"
        cboVideoCodec.Enabled = False
    End If
    cboVideoCodec.ListIndex = 0
End Sub
See also: ICImagingControl, AviCompressors, ICImagingControl.AviStartCapture, ICImagingControl.AviStopCapture

<< ICImagingControl


ICImagingControl::BacklightCompensation

ICImagingControl.BacklightCompensation Property
Returns or sets the backlight compensation value of the current video source.
Syntax:
Public BacklightCompensation As Long
Sample:

This example initializes a slider control with the selected video device's minimum, maximum and current backlight compensation settings. When the slider is moved, the video device's backlight compensation value is updated accordingly:

Private Sub Form_Load()
Dim Range As Variant
    Range = ICImagingControl1.BacklightCompensationRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.BacklightCompensation
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.BacklightCompensation  = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.BacklightCompensationAvailable, ICImagingControl.BacklightCompensationRange, ICImagingControl.BacklightCompensationAutoAvailable, ICImagingControl.BacklightCompensationAuto, ICImagingControl.BacklightCompensationDefault

<< ICImagingControl


ICImagingControl::Brightness

ICImagingControl.Brightness Property
Returns or sets the brightness value of the current video source.
Syntax:
Public Brightness As Long
Remarks:

Every access to Picture copies the image data from the buffer to a DIB.

The Picture interface that is returned is actually an IPictureDisp interface that can be used in Visual Basic.

Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current brightness settings. When the slider is moved, the video device's brightness value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.BrightnessRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Brightness
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Brightness = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.BrightnessAvailable, ICImagingControl.BrightnessRange, ICImagingControl.BrightnessAutoAvailable, ICImagingControl.BrightnessAuto, ICImagingControl.BrightnessDefault

<< ICImagingControl


ICImagingControl::ColorEnable

ICImagingControl.ColorEnable Property
Returns or sets the color enable value of the current video source.
Syntax:
Public ColorEnable As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current color enable settings. When the slider is moved, the video device's color enable value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.ColorEnable
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.ColorEnable
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.ColorEnable = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.ColorEnableAvailable, ICImagingControl.ColorEnableRange, ICImagingControl.ColorEnableAutoAvailable, ICImagingControl.ColorEnableAuto, ICImagingControl.ColorEnableDefault

<< ICImagingControl


ICImagingControl::Contrast

ICImagingControl.Contrast Property
Returns or sets the contrast value of the current video source.
Syntax:
Public Contrast As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current contrast settings. When the slider is moved, the video device's contrast value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.ContrastRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Contrast
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Contrast = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.ContrastAvailable, ICImagingControl.ContrastRange, ICImagingControl.ContrastAutoAvailable, ICImagingControl.ContrastAuto, ICImagingControl.ContrastDefault

<< ICImagingControl


ICImagingControl::Device

ICImagingControl.Device Property
Returns or sets a video capture device. A list of all available video capture devices can be obtained using the Devices collection, which can be retrieved with a call to ICImagingControl.Devices.
Syntax:
Public Device As String
Remarks:

Changing the device invalidates the ICImagingControl.VideoNorm and the ICImagingControl.InputChannel property and those which depend on these.

Sample:

This example selects the first available device:

Private Sub Form_Load()
    Dim Dev As Device
    ' Get the first video capture device
    Set Dev = ICImagingControl1.Devices.Item( 1 )
    ' Set the video capture device with the name property of Dev
    ICImagingControl1.Device = Dev.Name
End Sub

Selecting devices, input channels, video norms and video formats is shown in the Making Device Settings chapter.

See also: ICImagingControl, ICImagingControl.Devices, ICImagingControl.DeviceValid

<< ICImagingControl


ICImagingControl::DeviceCurrentActualFrameRate

ICImagingControl.DeviceCurrentActualFrameRate Property
Returns the frame rate currently used by the video capture device. A value of 0 indicates that this property is not supported by the video capture device.
Syntax:
Public DeviceCurrentActualFrameRate As Single
Limitations:

Run time only, read only. Only available in live mode.
Remarks:

DeviceCurrentActualFrameRate returns the number of frames actually sent by the video capture device. The actual frame rate depends on the bandwith and the video format. Therefore, the DeviceCurrentActualFrameRate may differ from the desired frame rate that has been set with the ICImagingControl.DeviceFrameRate property. It can be less than the desired frame rate if the bandwith is too low, but will never be greater.

If an application needs to display the actual frame rate, it is recommended to check the frame rate with DeviceCurrentActualFrameRate as shown in the example below.

Sample:

This example shows how to display the actual frame rate of the video capture device. A timer has been added to the application in order to update the display of the current frame rate periodically.

Private Sub Timer1_Timer()
    Dim currentFrameRate As Single
    currentFrameRate = 0
    ' Check whether the device is valid.
    If ICImagingControl1.DeviceValid Then
        ' Check whether the live video is running.
        If ICImagingControl1.LiveVideoRunning Then
            ' Get the current frame rate from ImagingControl.
            currentFrameRate = ICImagingControl1.DeviceCurrentActualFrameRate
            ' If it is greater than 0, the current frame rate is valid.
            If currentFrameRate > 0 Then
                ActFrameRate.Caption = Str(currentFrameRate)
            End If
        End If
    End If
   ' If currentFrameRate is equal to 0, it is not valid. That
   ' means that either the live video is not running, the device
   ' is invalid, or the device does not support this property.
    If currentFrameRate = 0 Then
        ActFrameRate.Caption = "n/a"
    End If
End Sub
See also: ICImagingControl, ICImagingControl.DeviceFrameRateAvailable, ICImagingControl.DeviceFrameRate, ICImagingControl.DeviceFrameRates

<< ICImagingControl


ICImagingControl::DeviceFlipHorizontal

ICImagingControl.DeviceFlipHorizontal Property
Returns or sets the horizontal flipping of the live video image.
Syntax:
Public DeviceFlipHorizontal As Boolean
See also: ICImagingControl, DeviceFlipHorizontalAvailable, DeviceFlipVertical, DeviceFlipVerticalAvailable

<< ICImagingControl


ICImagingControl::DeviceFlipHorizontalAvailable

ICImagingControl.DeviceFlipHorizontalAvailable Property
This property determines whether horizontal flip is available for the currently selected device.
Syntax:
Public DeviceFlipHorizontalAvailable As Boolean
Limitations:

Run time only, read only.
See also: ICImagingControl, ICImagingControl.DeviceFlipHorizontal, ICImagingControl.DeviceFlipVertical, ICImagingControl.DeviceFlipVerticalAvailable

<< ICImagingControl


ICImagingControl::DeviceFlipVertical

ICImagingControl.DeviceFlipVertical Property
Returns or sets the vertical flipping of the live video image.
Syntax:
Public DeviceFlipVertical As Boolean
See also: ICImagingControl, DeviceFlipVerticalAvailable, DeviceFlipHorizontal, DeviceFlipHorizontalAvailable

<< ICImagingControl


ICImagingControl::DeviceFlipVerticalAvailable

ICImagingControl.DeviceFlipVerticalAvailable Property
This property determines whether vertical flip is available for the currently selected device.
Syntax:
Public DeviceFlipVerticalAvailable As Boolean
Limitations:

Run time only, read only.
See also: ICImagingControl, ICImagingControl.DeviceFlipVertical, ICImagingControl.DeviceFlipHorizontal, ICImagingControl.DeviceFlipHorizontalAvailable

<< ICImagingControl


ICImagingControl::DeviceFrameRate

ICImagingControl.DeviceFrameRate Property
Returns or sets the desired frame rate (in frames per second) of the current video capture device.
Syntax:
Public DeviceFrameRate As Single
Limitations:

Only available when a device is open and valid.
Remarks:

A call to ICImagingControl.DeviceFrameRates retrieves all valid frame rates. Only valid frame rates may be set. If an invalid frame rate is specified, the default frame rate of the video capture device will be set instead.

The device frame rate depends on the current video format. Changing the ICImagingControl.VideoFormat property invalidates the device frame rate.

If the bandwidth is too low, the video capture device is not able to send frames according to the desired frame rate which is stored in DeviceFrameRate. The actual frame rate of the current device can be retrieved by using ICImagingControl.DeviceCurrentActualFrameRate.

Sample:

This example shows how to set a frame rate. Assume, that lstFrameRateList is a combo box, which was previously filled with the frame rates the video capture device supports:

Private Sub lstFrameRateList_Click()
    Dim SelectedRate As Integer
    Dim DevFrameRateCol As DeviceFrameRates
    ' Get the DeviceFrameRates collection from ICImagingControl
    Set DevFrameRateCol = ICImagingControl1.DeviceFrameRates
    ' Get the selected frame rate from the combo box.
    SelectedRate = lstFrameRateList.ListIndex + 1
    ' Stop the grabber before setting the new frame rate.
    cmdStopLive_Click
    ' Now, set the new frame rate
    ICImagingControl1.DeviceFrameRate = DevFrameRateCol.Item(SelectedRate)
End Sub
See also: ICImagingControl, ICImagingControl.DeviceFrameRateAvailable, ICImagingControl.DeviceFrameRates, ICImagingControl.DeviceCurrentActualFrameRate

<< ICImagingControl


ICImagingControl::DeviceFrameRateAvailable

ICImagingControl.DeviceFrameRateAvailable Property
Returns True, if setting of frame rates is supported by the video capture device.
Syntax:
Public DeviceFrameRateAvailable As Boolean
Limitations:

Run time only, read only. Only available when an ICImagingControl.Device is open and valid.

See also: ICImagingControl, ICImagingControl.DeviceFrameRates, ICImagingControl.DeviceFrameRate, ICImagingControl.DeviceCurrentActualFrameRate

<< ICImagingControl


ICImagingControl::DeviceFrameRates

ICImagingControl.DeviceFrameRates Property
Returns a collection of frame rates supported by the video capture device. May be empty if the device does not support frame rates.
Syntax:
Public DeviceFrameRates As DeviceFrameRates
Limitations:

Run time only, read only. Only available when an ICImagingControl.Device is open and valid.

Sample:

This example shows how to fill the a combo box named lstFrameRateList with the framerates the video capture device supports:

Private Sub FillFrameRateList()
    Dim FrameRateCol As DeviceFrameRates
    Dim Rate As Variant
    ' Do not forget to clear the combo box
   lstFrameRateList.Clear
    ' Get the DeviceFrameRates collection from ICImagingControl1
    Set FrameRateCol = ICImagingControl1.DeviceFrameRates
    ' Get all frame rates from the DeviceFrameRates collection
    ' and fill the combo box with the frame rates
    For Each Rate In FrameRateCol
        lstFrameRateList.AddItem Str(Rate)
    Next
End Sub
See also: ICImagingControl, ICImagingControl.DeviceFrameRates, ICImagingControl.DeviceFrameRateAvailable, ICImagingControl.DeviceFrameRate, ICImagingControl.DeviceCurrentActualFrameRate

<< ICImagingControl


ICImagingControl::DeviceTrigger

ICImagingControl.DeviceTrigger Property
Enables/disables external triggering of the current video capture device.
Syntax:
Public DeviceTrigger As Boolean
Limitations:

Only available when a device is open and valid.
Remarks:

If the trigger is enabled, the video capture device will not send images if no trigger event occurs. This may block an application while it waits for MemorySnapImage to return. To prevent blocking, a timeout value can be set with the MemorySnapTimeout property.

See also: ICImagingControl, ICImagingControl.DeviceTriggerAvailable

<< ICImagingControl


ICImagingControl::DeviceTriggerAvailable

ICImagingControl.DeviceTriggerAvailable Property
Returns True if the device has an external trigger.
Syntax:
Public DeviceTriggerAvailable As Boolean
Limitations:

Run time only, read only.
See also: ICImagingControl, ICImagingControl.DeviceTrigger

<< ICImagingControl


ICImagingControl::DeviceValid

ICImagingControl.DeviceValid Property
Returns True when a device is open and valid, otherwise False.
Syntax:
Public DeviceValid As Boolean
Limitations:

Run time only, read only.
Remarks:

Since the video capture device can become invalid at any time, this property should be checked whether it returns True before performing an action on the ICImagingControl.

See also: ICImagingControl, ICImagingControl.Device

<< ICImagingControl


ICImagingControl::Devices

ICImagingControl.Devices Property
Returns a collection of all available video capture devices.
Syntax:
Public Devices As Devices
Limitations:

Run time only, read only.
Sample:

This example displays all available video capture devices in a combo box. If no video capture devices are installed, the text "no devices found" will be displayed in the combo box. In this case the combo box will be disabled. The combo box for the video capture devices is named "cboVideoSource" in this example.

Private Sub UpdateDevices()
    Dim Name As String
    Dim DeviceCollection As Devices
    Dim Item As Variant
    Dim Idx As Long
    Idx = -1
    Set DeviceCollection = ImagingControl.Devices
    ' If a device has been selected previously, get its
   ' name to select it later in the combo box.
    If ImagingControl.DeviceValid Then
        Name = ImagingControl.Device
        ' Get the index of the device in the collection.
        Idx = DeviceCollection.FindIndex(Name)
    End If
    cboVideoSource.Clear
    If DeviceCollection.Count > 0 Then
        ' If devices have been found, add them to the
        ' combo box.
        For Each Item In DeviceCollection
            cboVideoSource.AddItem Item.Name
        Next
        cboVideoSource.Enabled = True
        If Idx <> -1 Then
            cboVideoSource.ListIndex = Idx - 1
        Else
            cboVideoSource.ListIndex = 0
        End If
    Else
        ' No devices have been found.
        cboVideoSource.AddItem "no devices found"
        cboVideoSource.Enabled = False
        cboVideoSource.ListIndex = 0
    End If
End Sub

A complete example of how to get the video capture device properties can be found in Making Device Settings.

See also: ICImagingControl, Devices, Device

<< ICImagingControl


ICImagingControl::Exposure

ICImagingControl.Exposure Property
Returns or sets the exposure value of the current video source.
Syntax:
Public Exposure As Long
Sample:

This Basic example initializes a Slider control with the selected video device's minimum, maximum and exposure enable settings. When the slider is moved, the video device's color enable value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.ExposureRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Exposure
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Exposure = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.ExposureAvailable, ICImagingControl.ExposureRange, ICImagingControl.ExposureAutoAvailable, ICImagingControl.ExposureAuto, ICImagingControl.ExposureDefault

<< ICImagingControl


ICImagingControl::ExternalTransportAvailable

ICImagingControl.ExternalTransportAvailable Property
Returns True if the video capture device has an external transport interface (e.g. DV-Devices).
Syntax:
Public ExternalTransportAvailable As Boolean
Limitations:

Read only.

<< ICImagingControl


ICImagingControl::ExternalTransportMode

ICImagingControl.ExternalTransportMode Property
Returns or sets the mode of the external transport device, if available.
Syntax:
Public ExternalTransportMode As ExternalTransportModes
Limitations:

Run time only.
See also: ICImagingControl, ICImagingControl.ExternalTransportAvailable, ExternalTransportModes

<< ICImagingControl


ICImagingControl::Focus

ICImagingControl.Focus Property
Returns or sets the focus value of the current video source.
Syntax:
Public Focus As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current focus settings. When the slider is moved, the video device's focus value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.FocusRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Focus
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Focus = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.FocusAvailable, ICImagingControl.FocusRange, ICImagingControl.FocusAutoAvailable, ICImagingControl.FocusAuto, ICImagingControl.FocusDefault

<< ICImagingControl


ICImagingControl::Gain

ICImagingControl.Gain Property
Returns or sets the gain value of the current video source.
Syntax:
Public Gain As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current gain settings. When the slider is moved, the video device's gain value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.GainRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Gain
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Gain = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.GainAvailable, ICImagingControl.GainRange, ICImagingControl.GainAutoAvailable, ICImagingControl.GainAuto, ICImagingControl.GainDefault

<< ICImagingControl


ICImagingControl::Gamma

ICImagingControl.Gamma Property
Returns or sets the gamma value of the current video source.
Syntax:
Public Gamma As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current gamma settings. When the slider is moved, the video device's gamma value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.GammaRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Gamma
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Gamma = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.GammaAvailable, ICImagingControl.GammaRange, ICImagingControl.GammaAutoAvailable, ICImagingControl.GammaAuto, ICImagingControl.GammaDefault

<< ICImagingControl


ICImagingControl::Hue

ICImagingControl.Hue Property
Returns or sets the hue value of the current video source.
Syntax:
Public Hue As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current hue settings. When the slider is moved, the video device's hue value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.HueRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Hue
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Hue = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.HueAvailable, ICImagingControl.HueRange, ICImagingControl.HueAutoAvailable, ICImagingControl.HueAuto, ICImagingControl.HueDefault

<< ICImagingControl


ICImagingControl::ImageBitsPerPixel

ICImagingControl.ImageBitsPerPixel Property
Returns the bits per pixel of the buffers in the control. The bytes per pixel are calculated by dividing ImageBitsPerPixel by 8. The value of this property is determined by the value of the ICImagingControl.MemoryCurrentGrabberColorformat property.
Syntax:
Public ImageBitsPerPixel As Long
Limitations:

Run time only, read only.
See also: ICImagingControl, ICImagingControl.MemoryCurrentGrabberColorformat

<< ICImagingControl


ICImagingControl::ImageBuffers

ICImagingControl.ImageBuffers Property
Returns a collection of ImageBuffers, which represent the buffers in the ringbuffer.
Syntax:
Public ImageBuffers As ImageBuffers
Limitations:

Run time only, read only.
See also: ICImagingControl, ImageBuffers, ICImagingControl.ImageRingBufferSize

<< ICImagingControl


ICImagingControl::ImageHeight

ICImagingControl.ImageHeight Property
Returns the image height (in pixels) of the current video source.
Syntax:
Public ImageHeight As Long
Limitations:

Run time only, read only.
See also: ICImagingControl, ICImagingControl.ImageWidth

<< ICImagingControl


ICImagingControl::ImageRingBufferSize

ICImagingControl.ImageRingBufferSize Property
Returns or sets the size of the internal ring buffer. Must lie in the range [1,...[.
Syntax:
Public ImageRingBufferSize As Long
Limitations:

Only available when a device is open and valid. Not available in live mode.

Remarks:

This method destroys the internal ring buffer if the new size is not equal to the current size of the ring buffer.

Exisiting references to ImageBuffer objects and collections are still valid, but they do not refer to the internal ring buffer anymore.

If there are global references to ImageBuffer objects or collections they have to be reassigned after setting this property.

See also: ICImagingControl, ICImagingControl.ImageBuffers

<< ICImagingControl


ICImagingControl::ImageWidth

ICImagingControl.ImageWidth Property
Returns the image width (in pixels) of the current video source.
Syntax:
Public ImageWidth As Long
Limitations:

Run time only, read only.
See also: ICImagingControl, ICImagingControl.ImageHeight

<< ICImagingControl


ICImagingControl::InputChannel

ICImagingControl.InputChannel Property
Returns or sets the input channel of the current video capture device. Available input channels can be enumerated using the InputChannels collection, which can be retrieved with a call to ICImagingControl.InputChannels.
Syntax:
Public InputChannel As String
Limitations:

Only available when a device is open and valid.
Remarks:

When the input channel is invalidated, the default input channel is selected, which depends on the current device.

The input channel depends on the current video capture device. So changing the ICImagingControl.Device property, will invalidate the input channel.

Note that input channels may not be supported on all video devices. While a frame grabber usually has several inputs to choose from, a camera that is connected directly to a USB or FireWire port will not have this feature. The Imaging Control's ICImagingControl.InputChannelAvailable can be used to determine whether input channels are supported.

Input channels may be set in live mode.

Sample:

This example selects the first channel supported by the current video capture device:

Dim Inp As InputChannel
Set Inp = ICImagingControl1.InputChannels.Item( 1 )
ICImagingControl1.InputChannel = Inp.Name

Selecting devices, input channels, video norms and video formats is shown in the Making Device Settings chapter.

See also: ICImagingControl, ICImagingControl.InputChannelAvailable, ICImagingControl.InputChannels, InputChannels

<< ICImagingControl


ICImagingControl::InputChannelAvailable

ICImagingControl.InputChannelAvailable Property
Returns True if the current video capture device supports input channels.
Syntax:
Public InputChannelAvailable As Boolean
Limitations:

Run time only, read only. Only available when a device is open and valid.

See also: ICImagingControl, ICImagingControl.InputChannel, ICImagingControl.InputChannels

<< ICImagingControl


ICImagingControl::InputChannels

ICImagingControl.InputChannels Property
Returns a collection of available input channels for the current video capture device.
Syntax:
Public InputChannels As InputChannels
Limitations:

Run time only, read only. Only available when a device is open and valid.

Sample:

This example displays all available input channels in a combo box. If no input channels are available, the text "n/a" will be displayed in the combo box. In this case the combo box will be disabled. The combo box for the input channels is named "cboInputChannel" in this example.

Private Sub UpdateInputChannels()
    Dim Name As String
    Dim ChannelCollection As InputChannels
    Dim Item As Variant
    Dim Idx As Long
    Idx = -1
    Set ChannelCollection = ImagingControl.InputChannels
    cboInputChannel.Clear
    If ChannelCollection.Count > 0 Then
        ' If input channels have been found,
        ' add them to the combo box.
        For Each Item In ChannelCollection
            cboInputChannel.AddItem Item.Name
        Next
        Name = ImagingControl.InputChannel
        Idx = ChannelCollection.FindIndex(Name)
        If Idx <> -1 Then
            cboInputChannel.ListIndex = Idx - 1
        Else
            cboInputChannel.ListIndex = 0
        End If
        cboInputChannel.Enabled = True
    Else
        ' No input channels have been found.
        cboInputChannel.AddItem "n/a"
        cboInputChannel.Enabled = False
        cboInputChannel.ListIndex = 0
    End If
End Sub

A complete example of how to get the video capture device properties can be found in the Making Device Settings chapter.

See also: ICImagingControl, InputChannels, ICImagingControl.InputChannelAvailable, ICImagingControl.InputChannel

<< ICImagingControl


ICImagingControl::Iris

ICImagingControl.Iris Property
Returns or sets the iris value of the current video source.
Syntax:
Public Iris As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current iris settings. When the slider is moved, the video device's iris value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.IrisRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Iris
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Iris = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.IrisAvailable, ICImagingControl.IrisRange, ICImagingControl.IrisAutoAvailable, ICImagingControl.IrisAuto, ICImagingControl.IrisDefault

<< ICImagingControl


ICImagingControl::LiveCaptureContinuous

ICImagingControl.LiveCaptureContinuous Property
Enables/disables the continuous capture mode. In this mode ICImagingControl.MemorySnapImage may not be called, because all frames are copied to the ring buffer automatically. After an image has been copied completely to a buffer, an ICImagingControl.ImageAvailable event is sent. If an ICImagingControl.ImageAvailable event is currently processed, a new event will not be sent.
Syntax:
Public LiveCaptureContinuous As Boolean
Limitations:

Has only an effect if set before a call to ICImagingControl.LiveStart.
Remarks:

The value of the ICImagingControl.LiveCaptureLastImage property is ignored.

Sample:

See Displaying Buffers on the ImageAvailable Event for an example on how to control the display of images buffers in the live capture continuous mode.

See also: ICImagingControl, ICImagingControl.LiveStart, ICImagingControl.MemorySnapImage, ICImagingControl.ImageAvailable

<< ICImagingControl


ICImagingControl::LiveCaptureLastImage

ICImagingControl.LiveCaptureLastImage Property
Enables/disables the automatic call to ICImagingControl.MemorySnapImage in ICImagingControl.LiveStop. This property should be set to True if ICImagingControl is to display the last frame after LiveStop has been called.
Syntax:
Public LiveCaptureLastImage As Boolean
Limitations:

Only affects the LiveStop call.
Remarks:

If the ICImagingControl.LiveCaptureContinuous property is enabled, the LiveCaptureLastImage property is ignored.

See also: ICImagingControl, ICImagingControl.MemorySnapImage, ICImagingControl.LiveStop

<< ICImagingControl


ICImagingControl::LiveCapturePause

ICImagingControl.LiveCapturePause Property
Returns or sets the pause for AVI capture.
Syntax:
Public LiveCapturePause As Boolean
Remarks:

The LiveCapturePause property is used to pause and restart AVI capture.

The LiveCapturePause property is used to pause and restart the image stream that goes to the sink. The sink is either an image buffers collection or an AVI file. The live display is not affected by this property. The LiveCapturePause property can be used to start an AVI recording when an event occurs (i.e. a click on a button) without latency. To do so, you have to set LiveCapturePause to true prior to a call to AviStartCapture. The call to AviStartCapture initializes the image stream and starts the live display (if the live display is enabled). Now, setting LiveCapturePause to False starts the AVI recording immediately because the image is already initialized.

If the LiveCapturePause property is set to True, the image stream going to the sink is paused. This means that the live display is not affected and the image stream remains initialized. LiveCapturePause may be set to True at any time and as often as you like.

If the LiveCapturePause property is set to False, the image stream going to the sink is started immediately if LiveStart was set to True or AviStartCapture was previously called.

If LiveCapturePause is set to True, while an image stream to an image buffers collection is active, MemorySnapImage and MemorySnapImageSequence are paused. This is typically the case when no AVI recording is taking place. if the timeout elapse before LiveCapturePause is set to False, MemorySnapImage and MemorySnapImageSequence return and report the timeout.

See also: ICImagingControl, ICImagingControl.AviStartCapture, ICImagingControl.AviStopCapture, ICImagingControl.MemorySnapImage, ICImagingControl.MemorySnapImageSequence, ICImagingControl.LivePause

<< ICImagingControl


ICImagingControl::LiveDisplay

ICImagingControl.LiveDisplay Property
Enables/disables live display in the control window. If live display is disabled, the image buffers may be shown by a call to ICImagingControl.Display.
Syntax:
Public LiveDisplay As Boolean
Limitations:

Only affects the ICImagingControl.LiveStart call. So setting a new value in live mode does not affect the display.

Sample:

See Displaying Buffers on the ImageAvailable Event for an example on how to do process live display.

See also: ICImagingControl, ICImagingControl.Display, ICImagingControl.DisplayImageBuffer, ICImagingControl.LiveStart

<< ICImagingControl


ICImagingControl::LiveDisplayDefault

ICImagingControl.LiveDisplayDefault Property
Returns or enables the use of the default size and position of the video display window.
Syntax:
Public LiveDisplayDefault As Boolean
Remarks:

Whether the size of the live video window can be changed or not can be toggled with the LiveDisplayDefault property. If LiveDisplayDefault returns True, the size of the live video window can not be adjusted. If LiveDisplayDefault is set to False, the size and position of the live video window can be adjusted to the application's needs.

If the LiveDisplayDefault is set to True, the values of LiveDisplayHeight and LiveDisplayWidth are reset to the video format's height and width. Also, the values of LiveDisplayTop and LiveDisplayLeft are reset to 0.

See also: ICImagingControl, ICImagingControl.LiveDisplayHeight, ICImagingControl.LiveDisplayLeft, ICImagingControl.LiveDisplayTop, ICImagingControl.LiveDisplayWidth, ICImagingControl.LiveDisplayZoomFactor, ICImagingControl.ScrollBarsEnabled

<< ICImagingControl


ICImagingControl::LiveDisplayHeight

ICImagingControl.LiveDisplayHeight Property
Returns or sets the height of the video display window.
Syntax:
Public LiveDisplayHeight As Long
Remarks:

The LiveDisplayHeight property is used to set a new height for the display window of the live video. If LiveDisplayHeight is set to a value different from the video format's height, the video image is distorted.

If the LiveDisplayHeight and the LiveDisplayWidth properties are changed, but the video image's ratio is preserved, the live video appears to be zoomed in or out. With these properties, the live video image can be fitted into IC Imaging Control's window.

Passing a value to LiveDisplayHeight takes only an effect, if the LiveDisplayDefault property was set to False. If the LiveDisplayDefault property is set to True, the LiveDisplayHeight property's value is reset to the video formats height.

The LiveDisplayHeight property's unit is pixel.

Sample:

This example demonstrates how to fit the live video display in IC Imaging Control's window.

' Set the used scale mode to pixel.
ScaleMode = 3
With ICImagingControl1
    ' Disable the live display's default values.
    .LiveDisplayDefault = False
    ' Set the width and height of the live video display to
    ' the width and height of IC Imaging Control. Now, the
    ' live video image fits into IC Imaging Control's window.
    .LiveDisplayHeight = .Height
    .LiveDisplayWidth = .Width
    ' Start the live video to see the result.
    .LiveStart
End With
See also: ICImagingControl, ICImagingControl.LiveDisplayDefault, ICImagingControl.LiveDisplayLeft, ICImagingControl.LiveDisplayTop, ICImagingControl.LiveDisplayWidth, ICImagingControl.LiveDisplayZoomFactor, ICImagingControl.ScrollBarsEnabled

<< ICImagingControl


ICImagingControl::LiveDisplayLeft

ICImagingControl.LiveDisplayLeft Property
Returns or sets the left position of the video display window in IC Imaging Control's window.
Syntax:
Public LiveDisplayLeft As Long
Remarks:

The LiveDisplayLeft property is used to move the video display window in IC Imaging Control's window. The value passed to LiveDisplayLeft is relative to the upper left corner of IC Imaging Control.

Passing a value to LiveDisplayLeft takes an effect, even if the LiveDisplayDefault property returns True.

If the LiveDisplayDefault property is set to True, the LiveDisplayLeft property's value is reset to 0.

The LiveDisplayLeft property's unit is pixel. It defaults to 0.

See also: ICImagingControl, ICImagingControl.LiveDisplayDefault, ICImagingControl.LiveDisplayHeight, ICImagingControl.LiveDisplayTop, ICImagingControl.LiveDisplayWidth, ICImagingControl.LiveDisplayZoomFactor, ICImagingControl.ScrollBarsEnabled

<< ICImagingControl


ICImagingControl::LiveDisplayTop

ICImagingControl.LiveDisplayTop Property
Returns or sets the top position of the video display window in IC Imaging Control's window.
Syntax:
Public Long LiveDisplayTop(Top As Long)
Remarks:

The LiveDisplayTop property is used to move the video display window in IC Imaging Control's window. The value passed to LiveDisplayTop is relative to the upper left corner of IC Imaging Control.

Passing a value to LiveDisplayTop takes an effect, even if the LiveDisplayDefault property returns True.

If the LiveDisplayDefault property is set to True, the LiveDisplayTop property's value is reset to 0.

The LiveDisplayTop property's unit is pixel. It defaults to 0.

See also: ICImagingControl, ICImagingControl.LiveDisplayDefault, ICImagingControl.LiveDisplayHeight, ICImagingControl.LiveDisplayLeft, ICImagingControl.LiveDisplayWidth, ICImagingControl.LiveDisplayZoomFactor, ICImagingControl.ScrollBarsEnabled

<< ICImagingControl


ICImagingControl::LiveDisplayWidth

ICImagingControl.LiveDisplayWidth Property
Returns or sets the width of the video display window.
Syntax:
Public LiveDisplayWidth As Long
Remarks:

The LiveDisplayWidth property is used to set a new width for the display window of the live video. If LiveDisplayWidth is set to a value different from the video format's width, the video image is distorted.

If the LiveDisplayHeight and the LiveDisplayWidth properties are changed, but the video image's ratio is preserved, the live video appears to be zoomed in or out. With these properties, the live video image can be fitted into IC Imaging Control's window.

Passing a value to LiveDisplayWidth takes only an effect, if the LiveDisplayDefault property was set to False. If the LiveDisplayDefault property is set to True, the LiveDisplayWidth property's value is reset to the video formats width.

The LiveDisplayWidth property's unit is pixel.

Sample:

This example demonstrates how to fit the live video display in IC Imaging Control's window.

' Set the used scale mode to pixel.
ScaleMode = 3
With ICImagingControl1
    ' Disable the the live display's default values.
    .LiveDisplayDefault = False
    ' Set the width and height of the live video display to
    ' the width and height of IC Imaging Control. Now, the
    ' live video image fits into IC Imaging Control's window.
    .LiveDisplayHeight = .Height
    .LiveDisplayWidth = .Width
    ' Start the live video to see the result.
    .LiveStart
End With
See also: ICImagingControl, ICImagingControl.LiveDisplayDefault, ICImagingControl.LiveDisplayHeight, ICImagingControl.LiveDisplayLeft, ICImagingControl.LiveDisplayTop, ICImagingControl.LiveDisplayZoomFactor, ICImagingControl.ScrollBarsEnabled

<< ICImagingControl


ICImagingControl::LiveDisplayZoomFactor

ICImagingControl.LiveDisplayZoomFactor Property
Returns or sets the zoom factor of the video display window.
Syntax:
Public LiveDisplayZoomFactor As Double
Remarks:

The LiveDisplayZoomFactor property is used to zoom the video display window in IC Imaging Control's window.

Passing a value to LiveDisplayZoomFactor only takes an effect, if the LiveDisplayDefault property returns False.

If the LiveDisplayDefault property is set to True, the LiveDisplayZoomFactor property's value is reset to 1.0.

Changing the value of the LiveDisplayZoomFactor property causes scrollbars to be adjusted anew. It also changes the values of LiveDisplayHeight and LiveDisplayWidth.

Setting the LiveDisplayZoomFactor property will restore the original video format's image ratio.

The LiveDisplayZoomFactor defaults to 1.0. Valid values must be greater than 0. 1.0 means the original size of the video image.

See also: ICImagingControl, ICImagingControl.LiveDisplayDefault, ICImagingControl.LiveDisplayHeight, ICImagingControl.LiveDisplayLeft, ICImagingControl.LiveDisplayTop, ICImagingControl.LiveDisplayWidth, ICImagingControl.ScrollBarsEnabled

<< ICImagingControl


ICImagingControl::LiveVideoRunning

ICImagingControl.LiveVideoRunning Property
Indicates whether a live video is running, i.e. has been started with the LiveStart Method.
Syntax:
Public LiveVideoRunning As Boolean
Limitations:

Run time only, read only.
See also: ICImagingControl, ICImagingControl.LiveStart, ICImagingControl.LiveStop

<< ICImagingControl


ICImagingControl::MediaStreamContainers

ICImagingControl.MediaStreamContainers Property
Returns a list containing all available MediaStreamContainers.
Syntax:
Public MediaStreamContainers As MediaStreamContainers
Limitations:

Run time only, read only.

Information:

Introduced in IC Imaging Control 3.0
See also: ICImagingControl, MediaStreamContainer, MediaStreamContainers

<< ICImagingControl


ICImagingControl::MemoryCurrentGrabberColorformat

ICImagingControl.MemoryCurrentGrabberColorformat Property
Determines the color format of the image buffers in the internal ring buffer.
Syntax:
Public MemoryCurrentGrabberColorformat As ICImagingControlColorformats
Limitations:

Not available in live mode.
See also: ICImagingControl, ImageBuffer, ICImagingControlColorformats

<< ICImagingControl


ICImagingControl::MemoryRingBufferSize

ICImagingControl.MemoryRingBufferSize Property
This property determines the size of the ring buffer that is used for the MemorySaveImageSequence and MemorySnapImageSequence methods.
Syntax:
Public MemoryRingBufferSize As Long
Remarks:

Depreciated. Use ICImagingControl.ImageRingBufferSize instead.

See also: ICImagingControl, ICImagingControl.ImageRingBufferSize

<< ICImagingControl


ICImagingControl::MemorySnapTimeout

ICImagingControl.MemorySnapTimeout Property
Returns or sets the snap timeout value. This is the time in milliseconds the functions ICImagingControl.MemorySnapImage and ICImagingControl.MemorySnapImageSequence wait until they abort.
Syntax:
Public MemorySnapTimeout As Long
Remarks:

TimeoutValue specifies the timeout value in milliseconds. Possible values are [0,+...] and -1. -1 means wait forever for the first frame.

See also: ICImagingControl, ICImagingControl.MemorySnapImage, ICImagingControl.MemorySnapImageSequence

<< ICImagingControl


ICImagingControl::OverlayBitmap

ICImagingControl.OverlayBitmap Property
Returns an OverlayBitmap object.
Syntax:
Public OverlayBitmap As OverlayBitmap
Limitations:

Run time only, read only.
Remarks:

The OverlayBitmap object is used for drawing and text operations on the live video.

See also: ICImagingControl, OverlayBitmap Object

<< ICImagingControl


ICImagingControl::OverlayUpdateEventEnable

ICImagingControl.OverlayUpdateEventEnable Property
This property is used to return or set whether the overlay update event should be called by IC Imaging Control.
Syntax:
Public OverlayUpdateEventEnable As Boolean
Limitations:

Run time only.
Remarks:

The OverlayUpdateEvent property is set to True per default.

Sample:

This example demonstrates how to check, whether the overlay update event should be called.

If ICImagingControl1.DeviceValid = True Then
    ' Check whether the overlay update event is enabled.
    If ICImagingControl1.OverlayUpdateEventEnable = False Then
        ' Enable the overlay update event.
        ICImagingControl1.OverlayUpdateEventEnable = True
    End If
End If
See also: ICImagingControl, OverlayUpdate event, OverlayBitmap Class

<< ICImagingControl


ICImagingControl::Pan

ICImagingControl.Pan Property
Returns or sets the pan value of the current video source.
Syntax:
Public Pan As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current pan settings. When the slider is moved, the video device's pan value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.PanRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Pan
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Pan = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.PanAvailable, ICImagingControl.PanRange, ICImagingControl.PanAutoAvailable, ICImagingControl.PanAuto, ICImagingControl.PanDefault

<< ICImagingControl


ICImagingControl::Picture

ICImagingControl.Picture Property
Returns a Picture object created from the data of the current buffer.
Syntax:
Public Picture As Picture
Remarks:

Every access to Picture copies the buffer data from the plain buffer to a DIB. If a PictureBox is only used to display a manipulated image buffer, an application can use ICImagingControl.DisplayImageBuffer. For a sample see Displaying Buffers on the ImageAvailable Event.

Sample:

This example shows how to assign a picture from an image buffer to a picturebox:

picPictureBox.Picture = ICImagingControl1.Picture
See also: ICImagingControl, ICImagingControl.MemorySnapImage

<< ICImagingControl


ICImagingControl::ReferenceTimeCurrent

ICImagingControl.ReferenceTimeCurrent Property
Returns the current reference time.
Syntax:
Public ReferenceTimeCurrent As Double
Remarks:

The property's unit is seconds.

If the ReferenceTimeCurrent is retrieved while the live video is not running, the error message "Run-time error '20' This function cannot be called if livemode is inactive" is issued.

Sample:

This example demonstrates how to show a live video for five seconds.

If ICImagingControl1.DeviceValid = True Then
    With ICImagingControl1
        .LiveStart
        While .ReferenceTimeCurrent - .ReferenceTimeStart < 5
            Debug.Print .ReferenceTimeCurrent - .ReferenceTimeStart
        Wend
    End With
End If
See also: ICImagingControl, ICImagingControl.LiveStart, ICImagingControl.ReferenceTimeStart

<< ICImagingControl


ICImagingControl::ReferenceTimeStart

ICImagingControl.ReferenceTimeStart Property
Returns the reference time at which the image stream was started.
Syntax:
Public ReferenceTimeStart As Double
Remarks:

If ICImagingControl.LiveStart has been called, all necessary filters are connected. This could take some time. After the all filters have been connected, the video stream started. This is the time that is returned by the ReferenceTimeStart property.

The property's unit is seconds.

If the ReferenceTimeStart is retrieved while the live video is not running, the error message "Run-time error '20' This function cannot be called if livemode is inactive" is displayed.

Sample:

This example demonstrates how to show a live video for five seconds.

If ICImagingControl1.DeviceValid = True Then
    With ICImagingControl1
        .LiveStart
        While .ReferenceTimeCurrent - .ReferenceTimeStart < 5
            Debug.Print .ReferenceTimeCurrent - .ReferenceTimeStart
        Wend
    End With
End If
See also: ICImagingControl, ICImagingControl.LiveStart, ICImagingControl.ReferenceTimeCurrent

<< ICImagingControl


ICImagingControl::Roll

ICImagingControl.Roll Property
Returns or sets the roll value of the current video source.
Syntax:
Public Roll As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current roll settings. When the slider is moved, the video device's roll value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.RollRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Roll
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Roll = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.RollAvailable, ICImagingControl.RollRange, ICImagingControl.RollAutoAvailable, ICImagingControl.RollAuto, ICImagingControl.RollDefault

<< ICImagingControl


ICImagingControl::Saturation

ICImagingControl.Saturation Property
Returns or sets the saturation value of the current video source.
Syntax:
Public Saturation As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current saturation settings. When the slider is moved, the video device's saturation value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.SaturationRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Saturation
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Saturation = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.SaturationAvailable, ICImagingControl.SaturationRange, ICImagingControl.SaturationAutoAvailable, ICImagingControl.SaturationAuto, ICImagingControl.SaturationDefault

<< ICImagingControl


ICImagingControl::ScrollBarsEnabled

ICImagingControl.ScrollBarsEnabled Property
Returns whether scrollbars are enabled or enables/disables scrollbars.
Syntax:
Public ScrollBarsEnabled As Boolean
Remarks:

If the ScrollbarsEnabled property is set to True and the window of IC Imaging Control is smaller than the live video window, scrollbars are displayed at the borders of Imaging Control. With the scrollbars, the user can move the live video in IC Imaging Control's window.

If the live video image is horizontally scrolled, the event sub ICImagingControl.OnHScroll is called. If it is vertically scrolled, the event sub ICImagingControl.OnVScroll is called.

The ScrollbarsEnabled property defaults to False. This means, the scrollbars are not visible.

See also: ICImagingControl, ICImagingControl.LiveDisplayHeight, ICImagingControl.LiveDisplayWidth, ICImagingControl.OnHScroll, ICImagingControl.OnVScroll

<< ICImagingControl


ICImagingControl::Sharpness

ICImagingControl.Sharpness Property
Returns or sets the sharpness value of the current video source.
Syntax:
Public Sharpness As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current sharpness settings. When the slider is moved, the video device's sharpness value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.SharpnessRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Sharpness
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Sharpness = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.SharpnessAvailable, ICImagingControl.SharpnessRange, ICImagingControl.SharpnessAutoAvailable, ICImagingControl.SharpnessAuto, ICImagingControl.SharpnessDefault

<< ICImagingControl


ICImagingControl::SinkCompatibilityMode

ICImagingControl.SinkCompatibilityMode Property
When SinkCompatibilityMode is enabled, TODO
Syntax:
Public SinkCompatibilityMode As Boolean
Remarks:

The default setting is True.

Information:

Introduced in IC Imaging Control 3.0
See also: ICImagingControl

<< ICImagingControl


ICImagingControl::Tilt

ICImagingControl.Tilt Property
Returns or sets the tilt value of the current video source.
Syntax:
Public Tilt As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current tilt settings. When the slider is moved, the video device's tilt value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.TiltRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Tilt
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Tilt = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.TiltAvailable, ICImagingControl.TiltRange, ICImagingControl.TiltAutoAvailable, ICImagingControl.TiltAuto, ICImagingControl.TiltDefault

<< ICImagingControl


ICImagingControl::VideoFormat

ICImagingControl.VideoFormat Property
Returns or sets the video format of the current video capture device. A list of available video formats can be obtained using the VideoFormats collection, which can be retrieved with a call to ICImagingControl.VideoFormats.
Syntax:
Public VideoFormat As String
Limitations:

Only available when a device is open and valid. Not available in live mode.
Remarks:

When the video format is invalidated, the first available video format for the device is selected.

The video format depends on the current video norm. So changing the ICImagingControl.VideoNorm property, will invalidate the video format.

Changing the video format invalidates the ICImagingControl.DeviceFrameRate property.

Sample:

This example selects the first video format that is supported by the current video capture device:

Dim Fmt As VideoFormat
Set Fmt = ICImagingControl1.VideoFormats.Item( 1 )
ICImagingControl1.VideoFormat = Fmt.Name
See also: ICImagingControl, ICImagingControl.VideoFormats, VideoFormats

<< ICImagingControl


ICImagingControl::VideoFormats

ICImagingControl.VideoFormats Property
Returns a collection of available video formats for the current device and video norm.
Syntax:
Public VideoFormats As VideoFormats
Limitations:

Run time only, read only. Only available when a device is open and valid. Not available in live mode.

Sample:

This example displays all available video formats of the current selected video capture device in a combo box. If no video formats are available, the text "n/a" will be displayed in the combo box . In this case the combo box will be disabled. The combo box for the video formats is named "cboVideoFormat" in this example.

Private Sub UpdateVideoFormats()
    Dim Name As String
    Dim VidFmtCol As VideoFormats
    Dim Item As Variant
    Dim Idx As Long
    Idx = -1
    Set VidFmtCol = ImagingControl.VideoFormats
    cboVideoFormat.Clear
    If VidFmtCol.Count > 0 Then
        ' If video formats have been found, add them to the
        ' combo box.
        For Each Item In VidFmtCol
            cboVideoFormat.AddItem Item.Name
        Next
        cboVideoFormat.Enabled = True
        Name = ImagingControl.VideoFormat
        Idx = VidFmtCol.FindIndex(Name)
        If Idx <> -1 Then
                cboVideoFormat.ListIndex = Idx - 1
        Else
            cboVideoFormat.ListIndex = 0
        End If
    Else
        ' No video formats have been found.
        cboVideoFormat.AddItem "n/a"
        cboVideoFormat.Enabled = False
        cboVideoFormat.ListIndex = 0
    End If
End Sub

A complete example of how to get the video capture device properties can be found in Making Device Settings.

See also: ICImagingControl, VideoFormats, VideoFormat

<< ICImagingControl


ICImagingControl::VideoNorm

ICImagingControl.VideoNorm Property
Returns or sets the video norm of the current video capture device. A list of available video norms can be obtained using the VideoNorms collection, which can be retrieved with by calling ICImagingControl.VideoNorms.
Syntax:
Public VideoNorm As String
Limitations:

Only available when a device is open and valid. Not available in live mode.

Remarks:

When the video norm is invalidated, the default video norm is selected, which depends on the device.

The video norm depends on the current device. So changing the ICImagingControl.Device property, will invalidate the video norm.

Changing the video norm invalidates the ICImagingControl.VideoFormat property.

Note that video norms may not be supported on all video capture devices. A video camera that is connected to a frame grabber usually supports either NTSC or PAL as a video norm, and the correct one must be selected in order to get an image from the grabber. Cameras that are connected directly via USB or FireWire ports usually do not use a video norm. The ICImagingControl.VideoNormAvailable property can be used to determine whehter video norms are supported.

Sample:

This example selects the first video norm supported by the current video capture device :

Dim Nrm As VideoNorm
Set Nrm = ICImagingControl1.VideoNorms.Item( 1 )
ICImagingControl1.VideoNorm = Nrm.Name
See also: ICImagingControl, ICImagingControl.VideoNormAvailable, ICImagingControl.VideoNorms, VideoNorms

<< ICImagingControl


ICImagingControl::VideoNormAvailable

ICImagingControl.VideoNormAvailable Property
Returns whether the current device supports video norms.
Syntax:
Public VideoNormAvailable As Boolean
Limitations:

Run time only, read only. Only available when a device is open and valid.

See also: ICImagingControl, ICImagingControl.VideoNorm, ICImagingControl.VideoNorms

<< ICImagingControl


ICImagingControl::VideoNorms

ICImagingControl.VideoNorms Property
Returns a collection of available video norms for the current device.
Syntax:
Public VideoNorms As VideoNorms
Limitations:

Run time only, read only. Only available when a device is open and valid.

Sample:

This example displays all available video norms supported by the current selected video capture device in a combo box. If no video norms are availalbe, the text "n/a" will be displayed in the combo box. In this case the combo box will be disabled. If a device is valid, it must have a video norm anyway. The combo box for the video norms is named "cboVideoNorm" in this example.

Private Sub UpdateVideoNorms()
    Dim Name As String
    Dim VidNrmCol As VideoNorms
    Dim Item As Variant
    Dim Idx As Long
    Idx = -1
    Set VidNrmCol = ImagingControl.VideoNorms
    cboVideoNorm.Clear
    If VidNrmCol.Count > 0 Then
        ' If video norms have been found, add them to the
        ' combo box.
        For Each Item In VidNrmCol
            cboVideoNorm.AddItem Item.Name
        Next
        ' Get the previously selected video norm.
        cboVideoNorm.Enabled = True
        Name = ImagingControl.VideoNorm
        Idx = VidNrmCol.FindIndex(Name)
        If Idx <> -1 Then
            cboVideoNorm.ListIndex = Idx - 1
        Else
            cboVideoNorm.ListIndex = 0
        End If
    Else
        ' No video norms have been found.
        cboVideoNorm.AddItem "n/a"
        cboVideoNorm.Enabled = False
        cboVideoNorm.ListIndex = 0
    End If
End Sub

A complete example of how to get the video capture device properties can be found in Making Device Settings.

See also: ICImagingControl, VideoNorms, VideoNormAvailable, VideoNorm

<< ICImagingControl


ICImagingControl::WhiteBalance

ICImagingControl.WhiteBalance Property
Returns or sets the whitebalance value of the current video source.
Syntax:
Public WhiteBalance As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current whitebalance settings. When the slider is moved, the video device's whitebalance value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.WhitebalanceRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Whitebalance
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Whitebalance = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.WhiteBalanceAvailable, ICImagingControl.WhiteBalanceRange, ICImagingControl.WhiteBalanceAutoAvailable, ICImagingControl.WhiteBalanceAuto, ICImagingControl.WhiteBalanceDefault

<< ICImagingControl


ICImagingControl::Zoom

ICImagingControl.Zoom Property
Returns or sets the zoom value of the current video source.
Syntax:
Public Zoom As Long
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current zoom settings. When the slider is moved, the video device's zoom value is updated accordingly:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.ZoomRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Zoom
End Sub
Private Sub Slider1_Scroll()
    ICImagingControl1.Zoom = Slider1.Value
End Sub
See also: ICImagingControl, ICImagingControl.ZoomAvailable, ICImagingControl.ZoomRange, ICImagingControl.ZoomAutoAvailable, ICImagingControl.ZoomAuto, ICImagingControl.ZoomDefault

<< ICImagingControl


ICImagingControl::xxAuto

ICImagingControl.xxAuto Property
These properties can be used to enable the automatic setting of a feature. For instance, the BrightnessAuto property will enable the device's automatic brightness control.
Syntax:
Public xxAuto As Boolean
See also: ICImagingControl, ICImagingControl.xxAvailable, ICImagingControl.xxRange, ICImagingControl.xxDefault

<< ICImagingControl


ICImagingControl::xxAutoAvailable

ICImagingControl.xxAutoAvailable Property
These properties can be used to determine whether a feature is available for the currently selected device. for instance, the BrightnessAvailable property has a value of True if the Brightness property is supported.
Syntax:
Public xxAutoAvailable As Boolean
Limitations:

Run time only, read only.
See also: ICImagingControl, ICImagingControl.xxAuto, ICImagingControl.xxRange, ICImagingControl.xxDefault

<< ICImagingControl


ICImagingControl::xxAvailable

ICImagingControl.xxAvailable Property
These properties can be used to determine whether a feature is available for the currently selected device. For instance, the BrightnessAvailable property has a value of True if the Brightness property is supported.
Syntax:
Public xxAvailable As Boolean
Limitations:

Run time only, read only.
See also: ICImagingControl, ICImagingControl.xxAuto, ICImagingControl.xxRange, ICImagingControl.xxDefault

<< ICImagingControl


ICImagingControl::xxDefault

ICImagingControl.xxDefault Property
These properties can be used to retrieve the default value of a property for the currently selected device.
Syntax:
Public xxAuto As Boolean
See also: ICImagingControl, ICImagingControl.xxAvailable, ICImagingControl.xxAuto, ICImagingControl.xxDefault

<< ICImagingControl


ICImagingControl::xxRange

ICImagingControl.xxRange Property
These properties can be used to determine the valid range of values for a property. For instance, the BrightnessRange property will return the minimum and maximum brightness values supported by the selected device.
Syntax:
Public xxRange As Variant
Limitations:

Run time only, read only.
Sample:

This example initializes a Slider control with the selected video device's minimum, maximum and current brightness settings:

Private Sub Form_Load()
    Dim Range As Variant
    Range = ICImagingControl1.BrightnessRange
    Slider1.Min = Range(0)
    Slider1.Max = Range(1)
    Slider1.Value = ICImagingControl1.Brightness
End Sub
See also: ICImagingControl, ICImagingControl.xxAuto, ICImagingControl.xxAvailable, ICImagingControl.xxDefault

<< ICImagingControl


ICImagingControl::AviStartCapture

ICImagingControl.AviStartCapture Method
This method writes a compressed AVI file to the computer's hard disk.
Syntax:
Public Sub AviStartCapture(Filename As String, Compressor As String)

Parameter | Description
Filename | Specifies a filename for the AVI file.
Compressor | Specifies the name of a video compressor. A list of available compressors can be obtained from an AviCompressors collection.
Remarks:

During capture the only allowed operation with ICImagingControl is to stop capture.

It is suggested to disable the live display, by assigning ICImagingControl.LiveDisplay property to False, in order to save performance.

See also: ICImagingControl, ICImagingControl.AviCompressors, AviCompressor, AviCompressors, ICImagingControl.AviStopCapture, ICImagingControl.LiveCapturePause

<< ICImagingControl


ICImagingControl::AviStopCapture

ICImagingControl.AviStopCapture Method
This method stops writing an AVI file.
Syntax:
Public Sub AviStopCapture()
See also: ICImagingControl, ICImagingControl.AviCompressors, AviCompressor, AviCompressors, ICImagingControl.AviStartCapture, ICImagingControl.LiveCapturePause

<< ICImagingControl


ICImagingControl::Display

ICImagingControl.Display Method
Displays the current image buffer in IC Imaging Control's window.
Syntax:
Public Sub Display()
Remarks:

This method can only be used, if the property ICImagingControl.LiveDisplay was set to False. In this case, IC Imaging Control would not display the live video. When the Display method is called, only the current frame in the image buffer is displayed.

See also: ICImagingControl, ICImagingControl.LiveDisplay, ICImagingControl.DisplayImageBuffer

<< ICImagingControl


ICImagingControl::DisplayImageBuffer

ICImagingControl.DisplayImageBuffer Method
When the property ICImagingControl.LiveDisplay is False , then a call to ICImagingControl.DisplayImageBuffer displays the given buffer in the control window
Syntax:
Public Sub DisplayImageBuffer(Buffer As ImageBuffer)

Parameter | Description
Buffer | Specifies the buffer to display.
Limitations:

Run time only, read only.
See also: ICImagingControl, ICImagingControl.LiveDisplay, ImageBuffer, ICImagingControl.Display

<< ICImagingControl


ICImagingControl::LiveStart

ICImagingControl.LiveStart Method
This method starts the processing of images delivered by the video capture device.
Syntax:
Public Sub LiveStart()
Remarks:

It is not allowed to call this method while the control is writing image data to an AVI file.

Imaging Control provides different modes for the processing of image data, i.e. displaying a live image. The different live modes are determined by two properties:

  • ICImagingControl.LiveDisplay: determines whether a live image is displayed.
  • ICImagingControl.LiveCaptureContinuous: deteremines whether frames are copied continuously to the internal ring buffer.

After ICImagingControl.LiveStart has been called, ICImagingControl.LiveDisplay and ICImagingControl.LiveCaptureContinuous may not be altered.

See also: ICImagingControl, ICImagingControl.LiveStop, ICImagingControl.LiveVideoRunning

<< ICImagingControl


ICImagingControl::LiveStop

ICImagingControl.LiveStop Method
Calling this method stops the display of a live image previously started with the LiveStart method.
Syntax:
Public Sub LiveStop()
Remarks:

The property ICImagingControl.LiveCaptureLastImage determines if the LiveStop method should snap a frame before stopping the live mode.

See also: ICImagingControl, ICImagingControl.LiveStart, ICImagingControl.LiveVideoRunning

<< ICImagingControl


ICImagingControl::MemoryGetDib

ICImagingControl.MemoryGetDib Method
This method is used to pass a Device Independent Bitmap to other programming tools for further processing.
Syntax:
Public Function MemoryGetDib() As Long
Return Value:

A handle to a Device Independent Bitmap (DIB).

Remarks:

If the LiveStart method has not been called, MemorySnapImage builds a filtergraph on its own whenever MemorySnapImage is called. If MemorySnapImage is called more than once, it is suggested to call LiveStart before calling MemorySnapImage.

This frees MemorySnapImage from initialization tasks it would otherwise have to perform each time it is called.

MemoryGetDib allocates global memory every time it is called. This memory is not released, because this would release the DIB in the other programming tools. So calling MemoryGetDib too often would cause an out of memory error. To prevent running out of memory an application needs to free this memory.

A global variable PicMemPointer needs to be added to the form:

Dim PicMemPointer As Long

The Windows function GlobalFree() frees global memory. It is implemented in kernel32.lib. The GlobalFree() function needs to be declared as follows in the form:

Private Declare Function GlobalFree Lib "kernel32" _
                         (ByVal hMem As Long) As Long

The example must be extended to:

Private Sub cmdLead_Click()
    ICImagingControl1.MemorySnapImage
    GlobalFree PicMemPointer
    PicMemPointer = ICImagingControl1.MemoryGetDib
    Form1.LEAD1.SetDIB PicMemPointer
End Sub
Sample:

This example snaps an image and passes it to a Leadtools control:

Private Sub cmdLead_Click()
    ICImagingControl1.MemorySnapImage
    Form1.LEAD1.SetDIB ICImagingControl1.MemoryGetDib
End Sub

Note that Leadtools is not a product of The Imaging Source and is not shipped with IC Imaging Control.

See also: ICImagingControl, ICImagingControl.MemoryGetImageData

<< ICImagingControl


ICImagingControl::MemoryGetImageData

ICImagingControl.MemoryGetImageData Method
Provides direct access to the image data of Imaging Control.
Syntax:
Public Function MemoryGetImageData() As Variant
Return Value:

The MemoryGetImageData method returns a SAFEARRAY of Byte in a Variant that provides direct access to the internal image data. Calling this method does not copy the image data. This SAFEARRAY has the dimensions Width = (0 To ( ICImagingControl.ImageWidth * ( ICImagingControl.ImageBitsPerPixel / 8)) - 1) Height = (0 To ICImagingControl.ImageHeight - 1)

Remarks:

The Variant must be released by a call to ICImagingControl.MemoryReleaseImageData. Not releasing it may lead to a black buffer or even worse side effects. This is, because MemoryGetImageData locks the image buffer to prevent it from being overwritten.

The data is arranged bottom up because the buffer has similar properties to a DIB. So the first row of the image is the last row in the image buffer.

The pixel format in the buffer is equal to the ICImagingControl.MemoryCurrentGrabberColorformat.

Sample:

This example snaps an image and inverts it. This sample requires the VideoFormat and MemoryCurrentGrabberColorformat to be set to 8 bit format:

Private Sub cmdStart_Click()
    Dim ImageData As Variant
    Dim x As Integer, y As Integer
    ICImagingControl1.MemorySnapImage
    ImageData = ICImagingControl1.MemoryGetImageData
    For y = 0 To ICImagingControl1.ImageHeight - 1
        For x = 0 To ICImagingControl1.ImageWidth - 1
            ImageData(x, y) = 255 - ImageData(x, y)
        Next x
    Next y
    ICImagingControl1.MemoryReleaseImageData ImageData
    ICImagingControl1.Display
End Sub
See also: ICImagingControl, ICImagingControl.MemoryReleaseImageData, ICImagingControl.ImageWidth, ICImagingControl.ImageHeight, ICImagingControl.ImageBitsPerPixel, ICImagingControl.MemoryGetDib

<< ICImagingControl


ICImagingControl::MemoryReleaseImageData

ICImagingControl.MemoryReleaseImageData Method
This method releases an image buffer that was allocated by calling the ICImagingControl.MemoryGetImageData.
Syntax:
Public Sub MemoryReleaseImageData(Buffer As Variant)

Parameter | Description
Buffer | Specifies the buffer to be released.
Sample:

See ICImagingControl.MemoryGetImageData.

See also: ICImagingControl, ICImagingControl.MemoryGetImageData

<< ICImagingControl


ICImagingControl::MemorySaveImage

ICImagingControl.MemorySaveImage Method
This method saves the current buffer as a .bmp file.
Syntax:
Public Sub MemorySaveImage(Filename As String)

Parameter | Description
Filename | Specifies the filename of the image file to be saved.
Remarks:

The pixel format of the bitmap is determined by the ICImagingControl.MemoryCurrentGrabberColorformat property.

Sample:

This example opens a common dialog box for the user to select a filename and then saves an image under this name:

Sub SaveImageFile(ic As ICImagingControl, cmdlg As CommonDialog)
    On Error GoTo err_SaveImageFile
    ' Snap an image if live image is running. Else use existing image.
    If ic.LiveVideoRunning Then
        ic.MemorySnapImage
    End If
    ' Open a common dialog to let the user select a filename and
    ' save the image.
    With cmdlg
        .Filter = "Bitmap (*.bmp)|*.bmp|"
        .CancelError = True
        .ShowSave
        ic.MemorySaveImage .FileName
    End With
Exit Sub
err_SaveImageFile:
    If Err <> cdlCancel Then MsgBox Err.Description
End Sub
See also: ICImagingControl, ICImagingControl.MemorySnapImage, ICImagingControl.MemoryCurrentGrabberColorformat

<< ICImagingControl


ICImagingControl::MemorySaveImageSequence

ICImagingControl.MemorySaveImageSequence Method
This method saves a sequence of images as a sequence of single .bmp files.
Syntax:
Public Sub MemorySaveImageSequence(SequenceLength As Long, Filename As String)

Parameter | Description
SequenceLength | Specifies the number of images to be saved.
Filename | Specifies the base filename of the image files to be saved. It must contain a "*" character, which will be replaced by a frame number. For example, specifying a SequenceLength of 3 and "c:\test*.bmp" as a Filename will create the 3 files "c:\test000.bmp", "c:\test001.bmp" and "c:\test002.bmp".
Sample:

This example will capture a sequence of 25 images to memory, and then save the images to 25 individual files. A "*" character is added to the filename to enable Imaging Control to insert a frame number:

Sub SaveImageSequence(ic As ICImagingControl, cmdlg As CommonDialog)
    On Error GoTo err_SaveImageSequence
    Const NumberOfImages = 25
    ic.ImageRingBufferSize = NumberOfImages
    ic.MemorySnapImageSequence NumberOfImages
    With cmdlg
        .Filter = "Bitmap (*.bmp)|*.bmp|"
        .CancelError = True
        .ShowSave
        ic.MemorySaveImageSequence NumberOfImages, _
            Left$(.FileName, Len(.FileName) - 4) & _
            "*" & _
            Right$(.FileName, 4)
    End With
    Exit Sub
err_SaveImageSequence:
    If Err <> cdlCancel Then MsgBox Err.Description
End Sub
See also: ICImagingControl, ICImagingControl.MemorySnapImageSequence, ICImagingControl.ImageRingBufferSize

<< ICImagingControl


ICImagingControl::MemorySnapImage

ICImagingControl.MemorySnapImage Method
This method captures a still image from a live video stream and stores it in an internal buffer. The buffer can be saved to a file using the ICImagingControl.MemorySaveImage Method.
Syntax:
Public Sub MemorySaveImage
Remarks:

In the capture continuous mode MemorySnapImage does nothing.

If the LiveCapturePause property is set to True, MemorySnapImage is paused. It will wait for a new frame, until the timeout occurs or the LiveCapturePause property is set to False.

See also: ICImagingControl, ICImagingControl.MemorySaveImage, ICImagingControl.LiveCapturePause

<< ICImagingControl


ICImagingControl::MemorySnapImageSequence

ICImagingControl.MemorySnapImageSequence Method
This method captures a sequence of still images from a live video stream and stores the images in a list of internal buffers. The images can be saved to individual files using the ICImagingControl.MemorySaveImageSequence method.
Syntax:
Public Sub MemorySnapImageSequence(ImageCount As Long)

Parameter | Description
ImageCount | Specifies number of images to be captured.
Remarks:

In the capture continuous mode MemorySnapImageSequence does nothing.

If the LiveCapturePause property is set to True, MemorySnapImageSequence is paused. It will wait for a new frame, until the timeout occurs or the LiveCapturePause property is set to False.

See also: ICImagingControl, ICImagingControl.MemorySaveImageSequence, ICImagingControl.ImageRingBufferSize, ICImagingControl.LiveCapturePause

<< ICImagingControl


ICImagingControl::DeviceLost

ICImagingControl.DeviceLost Event
This event is called if the video capture device is no longer valid; for example if it was unplugged.
Syntax:
Private Sub DeviceLost()
Remarks:

The ICImagingControl.Device property should be cleared by setting it to an empty string ("") in the DeviceLost sub.

Sample:

This example demonstrates how to implement a simple DeviceLost sub.

Private Sub ICImagingControl1_DeviceLost()
    MsgBox "The device has been lost!"
    Unload Me
End Sub
See also: ICImagingControl, ICImagingControl.Device, ICImagingControl.LiveStart, ICImagingControl.LiveStop

<< ICImagingControl


ICImagingControl::ImageAvailable

ICImagingControl.ImageAvailable Event
This event is called each time a frame has been copied completely to the internal ring buffer.
Syntax:
Private Sub ImageAvailable(BufferIndex As Long)

Parameter | Description
BufferIndex | Specifies the index to an image buffer in the ring buffer for which the event is called.
Limitations:

Before the ImageAvailable event will be fired, ICImagingControl.LiveCaptureContinuous must be set to True, the control must run in live mode and an event sink has to be registered (which is done by Visual Basic).

Remarks:

Inside an event procedure no Windows API functions should be called which cause a SendMessage (i.e. adding text to an edit box) because this may block the application.

While an event procedure is running, no new events are sent, but frames are still copied.

Exceptions that occur in the ImageAvailable event will get lost in the system. Therefore, bugs in the code that cause an exception cannot be recognized. To avoid this, use an On Error Goto ... statement. The On Error Goto ... statement should be put at the beginning of the event handler.If you need to display error messages, do not use a message box. Use a "debug trace" instead (e.g. Debug.Print ... ). This is very important, because otherwise the system may run into a deadlock which will cause the application to hang.

Sample:

This example implements an event procedure for the ImageAvailable event. In the event procedure an ImageBuffer ojbect is declared, which is used to take the image, for that the event has been called.

Private Sub ICImagingControl1_ImageAvailable(ByVal BufferIndex As Long)
    Dim DisplayBuffer As ImageBuffer
    Set DisplayBuffer = ICImagingControl1.ImageBuffers.Item(BufferIndex)
    ICImagingControl1.DisplayImageBuffer DisplayBuffer
End Sub

See the Displaying Buffers on the ImageAvailable Event example.

See also: ICImagingControl, ICImagingControl.LiveCaptureContinuous

<< ICImagingControl


ICImagingControl::MouseDown

ICImagingControl.MouseDown Event
This event is called if the user presses a mouse button inside the control window.
Syntax:
Private Sub MouseDown(Button As Long, Shift As Long, XPos As Short, YPos As Short)

Parameter | Description
Button | Specifies the buttons which are pressed. See Visual Basic help for documentation on the MouseDown event
Shift | Specifies the extended keys (like [ALT] and [SHIFT]) which are pressed. See Visual Basic help for documentation on the MouseDown event
XPos | Specifies the distance of the mouse cursor from the top left corner of the control.
YPos | Specifies the distance of the mouse cursor from the top left corner of the control.
See also: ICImagingControl, ICImagingControl.MouseUp, ICImagingControl.MouseMove

<< ICImagingControl


ICImagingControl::MouseMove

ICImagingControl.MouseMove Event
This event is called if the user moves the mouse inside the control window.
Syntax:
Private Sub MouseMove(Button As Long, Shift As Long, XPos As Short, YPos As Short)

Parameter | Description
Button | Specifies the buttons which are pressed. See Visual Basic help for documentation on the MouseMove event
Shift | Specifies the extended keys (like [ALT] and [SHIFT]) which are pressed. See Visual Basic help for documentation on the MouseMove event
XPos | Specifies the distance of the mouse cursor from the top left corner of the control.
YPos | Specifies the distance of the mouse cursor from the top left corner of the control.
See also: ICImagingControl, ICImagingControl.MouseDown, ICImagingControl.MouseUp

<< ICImagingControl


ICImagingControl::MouseUp

ICImagingControl.MouseUp Event
This event is called if the user releases a mouse button inside the control window.
Syntax:
Private Sub MouseUp(Button As Long, Shift As Long, XPos As Short, YPos As Short)

Parameter | Description
Button | Specifies the buttons which are pressed. See Visual Basic help for documentation on the MouseUp event
Shift | Specifies the extended keys (like [ALT] and [SHIFT]) which are pressed. See Visual Basic help for documentation on the MouseUp event
XPos | Specifies the distance of the mouse cursor from the top left corner of the control.
YPos | Specifies the distance of the mouse cursor from the top left corner of the control.
See also: ICImagingControl, ICImagingControl.MouseDown, ICImagingControl.MouseMove

<< ICImagingControl


ICImagingControl::OnHScroll

ICImagingControl.OnHScroll Event
This event is called after the user has scrolled the live video display horizontally.
Syntax:
Private Sub OnHScroll(XPos As Long, YPos As Long)

Parameter | Description
XPos | Specifies the new column of the live video display position. It is relative to the upper left corner of IC Imaging Control's window. Pixels are used as measurement unit.
YPos | Specifies the new row of the live video display position. It is relative to the upper left corner of IC Imaging Control's window. Pixels are used as measurement unit.
Limitations:

Run time only, read only.
See also: ICImagingControl, ICImagingControl.OnVScroll, ICImagingControl.ScrollBarsEnabled

<< ICImagingControl


ICImagingControl::OnVScroll

ICImagingControl.OnVScroll Event
This event is called after the user scrolled the live video display vertically.
Syntax:
Private Sub OnVScroll(XPos As Long, YPos As Long)

Parameter | Description
XPos | Specifies the new column of the live video display position. It is relative to the upper left corner of IC Imaging Control's window. Pixels are used as measurement unit.
YPos | Specifies the new row of the live video display position. It is relative to the upper left corner of IC Imaging Control's window. Pixels are used as measurement unit.
Limitations:

Run time only, read only.
See also: ICImagingControl, ICImagingControl.OnHScroll, ICImagingControl.ScrollBarsEnabled

<< ICImagingControl


ICImagingControl::OverlayUpdate

ICImagingControl.OverlayUpdate Event
This event is called after a new frame has been delivered by the video capture device.
Syntax:
Private Sub OverlayUpdate(ByVal Overlay As ICImagingControlCtl.OverlayBitmap, _
                               ByVal SampleStartTime As Double, _
                             ByVal SampleEndTime As Double )

Parameter | Description
Overlay | Specifies the Imaging Controls OverlayBitmap object
SampleStartTime | Specifies the sample start time in seconds. See remarks section for more information.
SampleEndTime | Specifies the sample end time in seconds. See remarks section for more information.
Remarks:

The OverlayUpdate event is called after a new frame is available. In the OverlayUpdate event sub, text or graphical elements can be drawn in the new frame. Therefore, it is possible to insert individual information on each individual frame.

The sample time is the time that has been passed, since ICImagingControl.LiveStart has been called. The time resolution is seconds. The duration between SampleStartTime and SampleEndTime is equal to the current frame rate.

This event is called before the ICImagingControl.ImageAvailable event occurs.

Exceptions that occur in the OverlayUpdate event will get lost in the system. Therefore, bugs in the code that cause an exception cannot be recognized. To avoid this, use an On Error Goto ... construct. The On Error Goto ... statement should be put at the beginning of the event handler. If you need to display error messages, do not use a message box. Use a "debug trace" instead (e.g. Debug.Print ... ). This is very important, because otherwise the system may run into a deadlock which will cause the application to hang.

Sample:

This example demonstrates how to write a frame counter on the live video. FrameCount is a global declared variable in the form.

Private Sub ICImagingControl1_OverlayUpdate(ByVal Overlay As ICImagingControlCtl.OverlayBitmap,  _
                                            ByVal SampleStartTime As Double, _
                                            ByVal SampleEndTime As Double)
    FrameCount = FrameCount + 1
    Overlay.DrawText RGB(255, 255, 0), 0, FrameCount
End Sub
See also: ICImagingControl, OverlayBitmap, ICImagingControl.LiveStart, ICImagingControl.ReferenceTimeStart, ICImagingControl.ReferenceTimeCurrent

<< ICImagingControl


ImageBuffer

An ImageBuffer object contains the image data of one frame. IC Imaging Control's internal ring buffer consists of ImageBuffers.

All image buffers of the ring buffer can be retrieved from the ImageBuffers collection.

Example

This example illustrates how to obtain the first available image buffer:

Dim Buffer As ImageBuffer
Set Buffer = ICImagingControl1.ImageBuffers.Item(1)

Information

Introduced in IC Imaging Control 1.x

Properties

Property | Description
FrameType | Returns a FrameType object describing the image format of this ImageBuffer.
ImageDataPtr | Returns the address of the first byte of the image data.
Lines | Returns the number of lines in this ImageBuffer.
Locked | Returns True if the ImageBuffer is locked.
Picture | Returns a Picture object created from the data in the buffer.
PixelPerLine | Returns the number of pixels in each line of this ImageBuffer.
SampleEndTime | Returns the reference end time of the sample in the image buffer.
SampleStartTime | Returns the reference start time of the sample in the image buffer.
WasLockedFlag | Returns the WasLockedFlag.

Methods

Method | Description
ForceUnlock | Reduces the lock count immediately to 0. Therefore, an image buffer is unlocked, enabling IC Imaging Control to copy an image to it.
GetDib | Returns a handle to a DIB for further imaging toolkits. This property is only available in the COM interface (Visual Basic 6).
GetImageData | Provides direct access to the data in the image buffer. This property is only available in the COM interface (Visual Basic 6).
Lock | Locks the buffer
ReleaseImageData | Releases a SAFEARRAY that was acquired by a call to ImageBuffer.GetImageData. This property is only available in the COM interface (Visual Basic 6).
SaveAsBitmap | Saves the contents of the buffer to a bitmap file on disk.
SaveAsJpeg | Saves the contents of the buffer to a JPEG compressed file to disk.
SaveImage | Saves the contents of the buffer to disk.
Unlock | Unlocks the buffer

<< Classes


ImageBuffer::Locked

ImageBuffer.Locked Property
Returns True if the ImageBuffer is locked.
Syntax:
Public Locked Boolean
Limitations:

Read only.
Sample:

This example shows how to determine whether an ImageBuffer is locked:

Dim Buf As ImageBuffer
Set Buf = ICImagingControl1.ImageBuffer.Item(1)
If Buf.Locked Then
    ' buffer is locked
Else
    ' buffer is not locked
End If
See also: ImageBuffer, ImageBuffer.Unlock, ImageBuffer.ForceUnlock, ImageBuffer.Lock

<< ImageBuffer


ImageBuffer::Picture

ImageBuffer.Picture Property
Returns a Picture object created from the data in the buffer.
Syntax:
Public Picture As Picture
Limitations:

Read only.
Remarks:

Every access to Picture copies the image data from the buffer to a DIB.

The Picture interface that is returned is actually an IPictureDisp interface that can be used in Visual Basic.

Sample:

This example shows how to assign a picture from an image buffer to a picture box:

Dim Buf As ImageBuffer
Set Buf = ICImagingControl1.ImageBuffers.Item(1)
picPictureBox.Picture = Buf.Picture
See also: ImageBuffer

<< ImageBuffer


ImageBuffer::SampleEndTime

ImageBuffer.SampleEndTime Property
Returns the reference end time of the sample in the image buffer.
Syntax:
Public SampleEndTime As Double
Limitations:

Run time only, read only.
Remarks:

The SampleEndTime property returns the reference time at which the sample ended, in seconds.

See also: ImageBuffer, SampleStartTime, ICImagingControl.ReferenceTimeStart, ICImagingControl.ReferenceTimeCurrent

<< ImageBuffer


ImageBuffer::SampleStartTime

ImageBuffer.SampleStartTime Property
Returns the reference start time of the sample in the image buffer.
Syntax:
Public SampleStartTime Double
Limitations:

Run time only, read only.
Remarks:

The SampleStartTime property returns the reference time the sample started in seconds.

See also: ImageBuffer, SampleEndTime, ICImagingControl.ReferenceTimeStart, ICImagingControl.ReferenceTimeCurrent

<< ImageBuffer


ImageBuffer::WasLockedFlag

ImageBuffer.WasLockedFlag Property
Returns the WasLockedFlag.
Syntax:
Public WasLockedFlag As Boolean
Remarks:

If IC Imaging Control tries to write to a locked buffer, it sets the WasLockedFlag to True and tries to write to the next buffer in the ring buffer. If a buffer was not locked, WasLockedFlag is set to False.

See also: ImageBuffer, ImageBuffer.Lock, ImageBuffer.Unlock, ImageBuffer.Locked

<< ImageBuffer


ImageBuffer::ForceUnlock

ImageBuffer.ForceUnlock Method
Reduces the lock count immediately to 0. Therefore, an image buffer is unlocked, enabling IC Imaging Control to copy an image to it.
Syntax:
Public Sub ForceUnlock()
Remarks:

ImageBuffer.Unlock should be used instead of ForceUnlock. If an application needs to unlock an image buffer and it is unknown how often this buffer was previously locked, the application should use ForceUnlock.

See also: ImageBuffer, ImageBuffer.Unlock, ImageBuffer.Lock, ImageBuffer.Locked

<< ImageBuffer


ImageBuffer::GetDib

ImageBuffer.GetDib Method
Returns a handle to a DIB for further imaging toolkits. This property is only available in the COM interface (Visual Basic 6).
Syntax:
Public Function GetDib() As Long
Return Value:

A HGLOBAL containing a DIB.

Remarks:

This function is only intended for use with other imaging toolkits.

See also: ImageBuffer, ImageBuffer.Picture

<< ImageBuffer


ImageBuffer::GetImageData

ImageBuffer.GetImageData Method
Provides direct access to the data in the image buffer. This property is only available in the COM interface (Visual Basic 6).
Syntax:
Public Function GetImageData As Variant
Return Value:

The GetImageData method returns a SAFEARRAY of Byte in a Variant that provides direct access to the internal image data. Calling this method does not copy the image data. This SAFEARRAY has the following dimensions:

Width = (0 To ( ICImagingControl.ImageWidth * ( ICImagingControl.ImageBitsPerPixel / 8)) - 1)

Height = (0 To ICImagingControl.ImageHeight - 1)

Sample:

This example shows how to invert the image data in an ImageBuffer:

Dim CurrentImageBuffer As ImageBuffer
Dim ImageData As VARIANT
Set CurrentImageBuffer = ICImagingControl1.ImageBuffers.Item(1)
ImageData = CurrentImageBuffer.GetImageData
For y = 0 To ICImagingControl1.ImageHeight - 1
    For x = 0 To (ICImagingControl1.ImageBitsPerPixel / 8 * ICImagingControl1.ImageWidth) - 1
        ImageData(x, y) = 255 - ImageData(x, y)
    Next x
Next y
CurrentImageBuffer.ReleaseImageData ImageData
See also: ImageBuffer, ImageBuffer.ReleaseImageData

<< ImageBuffer


ImageBuffer::Lock

ImageBuffer.Lock Method
Locks the buffer
Syntax:
Public Sub Lock()
Remarks:

Increments the lock count of the buffer by one, so that the control does not overwrite the data in the ImageBuffer. Each call to lock must be matched with a call to ImageBuffer.Unlock, so that the buffer can be used again by the control.

Sample:

This example locks and unlocks an ImageBuffer:

Dim Buf As ImageBuffer
Set Buf = ICImagingControl1.ImageBuffer.Item(1)
Buf.Lock
' do a lengthy operation
Buf.Unlock

A sample on how to use ImageBuffer and ImageBuffer.Lock is shown in Performing Advanced Image Processing.

See also: ImageBuffer, ImageBuffer.Unlock, ImageBuffer.ForceUnlock, ImageBuffer.Locked, ImageBuffer.WasLockedFlag

<< ImageBuffer


ImageBuffer::ReleaseImageData

ImageBuffer.ReleaseImageData Method
Releases a SAFEARRAY that was acquired by a call to ImageBuffer.GetImageData. This property is only available in the COM interface (Visual Basic 6).
Syntax:
Public Sub ReleaseImageData(ImageData As Variant)

Parameter | Description
ImageData | Specifies the data to be released.
Sample:

See ImageBuffer.GetImageData.

See also: ImageBuffer, ImageBuffer.GetImageData

<< ImageBuffer


ImageBuffer::SaveImage

ImageBuffer.SaveImage Method
Saves the contents of the buffer to disk.
Syntax:
Public Sub SaveImage(Filename As String)

Parameter | Description
Filename | The name of the file to which the buffer is saved.
Sample:

This example shows how to save the contents of an ImageBuffer to a file called "test.bmp":

Dim Buf As ImageBuffer
Set Buf = ICImagingControl1.ImageBuffers.Item(1)
Buf.SaveImage "test.bmp"
See also: ImageBuffer

<< ImageBuffer


ImageBuffer::Unlock

ImageBuffer.Unlock Method
Unlocks the buffer
Syntax:
Public Sub Unlock()
Remarks:

Calling ImageBuffer.Lock prevents an image buffer from being overwritten by IC Imaging Control. Internally, a lock count is incremented. Calling Unlock decrements the lock count until it is 0. If the internal lock count is 0, the image buffer is unlocked and can be overwritten by IC Imaging Control.

Sample:

See ImageBuffer.Lock for an example.

See also: ImageBuffer, ImageBuffer.Lock, ImageBuffer.ForceUnlock, ImageBuffer.Locked, ImageBuffer.WasLockedFlag

<< ImageBuffer


ImageBuffers

ImageBuffers is a collection of ImageBuffer objects. It represents the ring buffer used internally by Imaging Control. The ICImagingControl.ImageBuffers property returns an ImageBuffers collection.

Properties

Property | Description
Active | Returns the ImageBuffer to which the control copied the last frame.
Count | Returns the count of ImageBuffer objects in the collection.
CurrentIndex | Returns the index of the ImageBuffer to which the control copied the last frame.
Item | Returns the ImageBuffer at the specified position.

<< Classes


ImageBuffers::Count

ImageBuffers.Count Property
Returns the count of ImageBuffer objects in the collection.
Syntax:
Public Count As Long
Limitations:

Read only.
See also: ImageBuffers, ImageBuffer, ImageBuffers.Item

<< FrameHandlerSink.ImageBuffers


ImageBuffers::CurrentIndex

ImageBuffers.CurrentIndex Property
Returns the index of the ImageBuffer to which the control copied the last frame.
Syntax:
Public CurrentIndex As Long
Limitations:

Read only.
See also: ImageBuffers, ImageBuffer

<< FrameHandlerSink.ImageBuffers


ImageBuffers::Item

ImageBuffers.Item Property
Returns the ImageBuffer at the specified position.
Syntax:
Public Item(Index As Long) As ImageBuffer

Parameter | Description
Index | Specifies the index of the ImageBuffer to return. The index must be in the range [1, ImageBuffers.Count ], otherwise an error occurs.
Limitations:

Read only.
See also: ImageBuffers, ImageBuffer, ImageBuffers.Count

<< FrameHandlerSink.ImageBuffers


InputChannel

An InputChannel object contains the information about an analog input channel that is available on the current video capture device.

An InputChannel object can be obtained out of the InputChannels collection.

Example

Dim InpChannel As InputChannel
Set InpChannel = ICImagingControl1.InputChannels.Item( 1 )

Information

Introduced in IC Imaging Control 1.x

Properties

Property | Description
Name | Returns the name of the InputChannel.

<< Classes


InputChannel::Name

InputChannel.Name Property
Returns the name of the InputChannel.
Syntax:
Public Name As String
Limitations:

Read only.
Remarks:

This property is used to enable and disable the displaying of the overlay bitmap on the live video. Setting this property to False causes IC Imaging Control to hide the overlay bitmap. No drawings or texts can be seen. Setting this property to True causes IC Imaging Control to show the overlay bitmap on the live video. All texts and drawings can be seen.

The default value of Enable is False.

Sample:

This example selects the first available input channel.

Dim Inp As InputChannel
Set Inp = ICImagingControl1.InputChannels.Item( 1 )
ICImagingControl1.InputChannel = Inp.Name

Selecting devices, input channels, video norms and video formats is shown in the Making Device Settings chapter.

See also: InputChannel, InputChannels

<< ICImagingControl.InputChannel


InputChannels

InputChannels is a collection of InputChannel objects. A InputChannels collection is used to obtain the available input channels of the current video capture device. The ICImagingControl.InputChannels property returns a InputChannels collection.

Example

This example shows how to fill a combo box with the available input channels:

Dim InpCol As InputChannels
Dim Channel As InputChannel
Set InpCol = ICImagingControl1.InputChannels

For Each Channel In InpCol
    cboInputChannelComboBox.AddItem Channel.Name
Next

Properties

Property | Description
Count | Returns the count of InputChannel objects in the collection.
Item | Returns the InputChannel at the specified position.

Methods

Method | Description
FindIndex | Searches the collection for a given string. The string contains the name of an input channel.

<< Classes


InputChannels::Count

InputChannels.Count Property
Returns the count of InputChannel objects in the collection.
Syntax:
Public Count As Long
Limitations:

Read only.
Example:

This Basic example determines whether input channels are available:

Dim InpCol As InputChannels
Set InpCol = ICImagingControl1.InputChannels
If InpCol.Count > 0 then
    ' do something
else
    ' no input channels available
End If
See also: InputChannels, InputChannel, InputChannels.Item, InputChannels.FindIndex

<< InputChannels


InputChannels::Item

InputChannels.Item Property
Returns the InputChannel at the specified position.
Syntax:
Public Item(Index As Long) As InputChannel

Parameter | Description
Index | Specifies the Index of the InputChannel to return. The Index must lie in the range [1, InputChannels.Count ], otherwise an error occurs.
Limitations:

Read only.
Example:

This Basic example selects the first available input channel:

Dim InpCol As VideoFormat
Set InpCol = ICImagingControl1.InputChannels
ICImagingControl1.InputChannel = InpCol.Item( 1 )
See also: InputChannels, InputChannel, InputChannels.Count, InputChannels.FindIndex

<< InputChannels


InputChannels::FindIndex

InputChannels.FindIndex Method
Searches the collection for a given string. The string contains the name of an input channel.
Syntax:
Public Function FindIndex(Name As String) As Long

Parameter | Description
Name | Specifies the name of the input channel for which to search in the collection.
Return Value:

If the property Name of an InputChannel object is equal to the given string, the FindIndex method returns the index of this object in the collection. If the string is not found, the FindIndex method returns -1.

Example:

This Basic example tests whether the "00 Video: SVideo" channel is available:

Dim InpCol As InputChannels
Dim Index As long
Set InpCol = ICImagingControl1.InputChannels
Index = InpCol.FindIndex("00 Video: SVideo")
If Index = -1 Then
    ' input channel not available
Else
    ' do something
End If

Selecting devices, input channels, video norms and video formats is shown in the Making Device Settings chapter.

See also: InputChannels, InputChannel, InputChannels.Count, InputChannels.Item

<< InputChannels


OverlayBitmap

An OverlayBitmap object contains the overlay data, methods and properties for drawing text and graphics on the live video stream.

Example

Dim ob As OverlayBitmap
Set ob = ICImagingControl1.OverlayBitmap
' Enable the overlay bitmap for drawing.
ob.Enable = True
' Set magenta as dropout color.
ob.DropOutColor = RGB(255, 0, 255)
' Fill the overlay bitmap with the dropout color.
ob.Fill ob.DropOutColor
' Print some text with red color.
ob.FontTransparent = True
ob.DrawText RGB(255, 0, 0), 10, 10, "IC Imaging Control 2.0"

Information

Introduced in IC Imaging Control 1.x

Properties

Property | Description
ColorMode | Set the color mode of this OverlayBitmap. The color mode determines whether the overlay bitmap is painted in color or in grayscale. The images provided by the video capture device are converted into the selected format before drawing the overlay.
DropOutColor | Returns or sets the current dropout color.
Enable | Returns or sets the currently enabled state of the overlay bitmap.
FlipVertical | Returns or sets vertical flipping of the overlay bitmap.
Font | Returns or sets the font for OverlayBitmap.DrawText.
FontBackColor | Returns or sets the background color for OverlayBitmap.DrawText.
FontTransparent | Returns or sets the background mode for OverlayBitmap.DrawText.
OverlayFrameType | This property returns the actual image format of the overlay bitmap.
PathPosition | Returns the path position of this OverlayBitmap.

Methods

Method | Description
DrawFrameEllipse | This method draws an empty frame ellipse on the live video.
DrawFrameRect | This method draws an empty frame rectangle on the live video.
DrawLine | This method draws a line on the live video.
DrawSolidEllipse | This method draws a solid, filled ellipse on the live video.
DrawSolidRect | This method draws a solid, filled rectangle on the live video.
DrawText | This method draws text on the live video.
Fill | This method fills the entire overlay bitmap with the passed color.
GetDC | This method returns the device context of the OverlayBitmap object.
ReleaseDC | This method releases the device context of the OverlayBitmap object.

<< Classes


OverlayBitmap::DropOutColor

OverlayBitmap.DropOutColor Property
Returns or sets the current dropout color.
Syntax:
Public DropOutColor As Long
Limitations:

Run time only. Only after ICImagingControl.LiveStart has been called once.

Remarks:

This property is used to return and set the dropout color of the overlay bitmap. All pixels of the dropout color are not painted on the live video.

The dropout color can be set using the RGB method.

The default value for DropOutColor is black.

Example:

This example demonstrates how to use the dropout color.

Dim ob As OverlayBitmap
Set ob = ICImagingControl1.OverlayBitmap
' Enable the overlay bitmap for drawing.
ob.Enable = True
ICImagingControl1.LiveStart
' Set magenta as dropout color.
ob.DropOutColor = RGB(255, 0, 255)
' Fill the overlay bitmap with the dropout color.
ob.Fill ob.DropOutColor
See also: OverlayBitmap, OverlayBitmap.Fill

<< ICImagingControl.OverlayBitmap


OverlayBitmap::Enable

OverlayBitmap.Enable Property
Returns or sets the currently enabled state of the overlay bitmap.
Syntax:
Public Enable As Boolean
Limitations:

Run time only.
Remarks:

This property is used to enable and disable the displaying of the overlay bitmap on the live video. Setting this property to False causes IC Imaging Control to hide the overlay bitmap. No drawings or texts can be seen. Setting this property to True causes IC Imaging Control to show the overlay bitmap on the live video. All texts and drawings can be seen.

The default value of Enable is False.

Example:

This example demonstrates how to enable the display of the overlay bitmap.

Dim ob As OverlayBitmap
Set ob = ICImagingControl1.OverlayBitmap
' Enable the overlay bitmap for drawing.
ob.Enable = True
See also: OverlayBitmap

<< ICImagingControl.OverlayBitmap


OverlayBitmap::FlipVertical

OverlayBitmap.FlipVertical Property
Returns or sets vertical flipping of the overlay bitmap.
Syntax:
Public FlipVertical As Boolean
Limitations:

Run time only.
Remarks:

This property is used to enable and disable the vertical flipping of the overlay bitmap on the live video. If vertical flipping is enabled, the overlay bitmap will be drawn bottom up.

The default value of FlipVertical is False.

Example:

This example demonstrates how to enable vertical flipping.

Dim ob As OverlayBitmap
Set ob = ICImagingControl1.OverlayBitmap
' Enable vertical flipping.
ob.FlipVertical = True
See also: OverlayBitmap

<< ICImagingControl.OverlayBitmap


OverlayBitmap::Font

OverlayBitmap.Font Property
Returns or sets the font for OverlayBitmap.DrawText.
Syntax:
Public Font As StdFont
Limitations:

Run time only.
Example:

This example demonstrates how to create a font object and set it to the OverlayBitmap object to draw text.

Dim ob As OverlayBitmap
Dim Font As New StdFont
Font.Name = "Arial"
Font.Size = 14
Font.Bold = True
Set ob = ICImagingControl1.OverlayBitmap
' Set the created font.
ob.Font = Font
ob.DrawText RGB(255, 0, 0), 10, 10, "IC Imaging Control in Arial bold, size 14"
See also: OverlayBitmap, OverlayBitmap.DrawText, OverlayBitmap.FontBackColor, OverlayBitmap.FontTransparent

<< ICImagingControl.OverlayBitmap


OverlayBitmap::FontBackColor

OverlayBitmap.FontBackColor Property
Returns or sets the background color for OverlayBitmap.DrawText.
Syntax:
Public FontBackColor As Long
Limitations:

Run time only.
Remarks:

If the FontBackColor is equal to the DropOutColor, the surrounding solid rectangle of the text (text background) is not visible.

The default value for FontBackColor> is black.

Example:

This example demonstrates how to use the FontBackColor property.

Dim ob As OverlayBitmap
Set ob = ICImagingControl1.OverlayBitmap
' Use a blue background with red text.
ob.FontTransparent = False
ob.FontBackColor = RGB(0,0,255)
ob.DrawText RGB(255, 0, 0), 10, 10, "IC Imaging Control red on blue"
See also: OverlayBitmap, OverlayBitmap.DrawText, OverlayBitmap.Font, OverlayBitmap.FontTransparent

<< ICImagingControl.OverlayBitmap


OverlayBitmap::FontTransparent

OverlayBitmap.FontTransparent Property
Returns or sets the background mode for OverlayBitmap.DrawText.
Syntax:
Public FontTransparent As Boolean
Limitations:

Run time only.
Remarks:

This property is used to return and set the background mode to draw text.

If FontTransparent is set to True, OverlayBitmap.DrawText writes the text without a surrounding solid rectangle. The live video image can be seen through the text. If changing text is repeatedly written to the same position, it becomes unreadable, because the background is not cleared.

If FontTransparent is set to False, OverlayBitmap.DrawText writes the text with a surrounding solid rectangle. The rectangle has the color set with the OverlayBitmap.FontBackColor property. If changing text is repeatedly written to the same position, it stays readable, because the background is overwritten every time. If the FontBackColor is equal to OverlayBitmap.DropOutColor, the surrounding solid rectangle is not visible.

Hint: If changing text is displayed on the live video repeatedly (such as a clock), an application should set FontTransparent to False and OverlayBitmap.FontBackColor to the OverlayBitmap.DropOutColor. In doing so, the text remains readable.

The default value for FontTransparent is False.

Example:

This example demonstrates how to use the FontTransparent property:

Dim ob As OverlayBitmap
Set ob = ICImagingControl1.OverlayBitmap
' Print some text with red color and transparent background.
ob.FontTransparent = True
ob.DrawText RGB(255, 0, 0), 10, 10, "IC Imaging Control"
See also: OverlayBitmap, OverlayBitmap.DrawText, OverlayBitmap.DropOutColor, OverlayBitmap.FontBackColor

<< ICImagingControl.OverlayBitmap


OverlayBitmap::DrawLine

OverlayBitmap.DrawLine Method
This method draws a line on the live video.
Syntax:
Public Sub DrawLine( color As Long, startcolumn As Long, startrow As Long, endcolumn As Long, endrow As Long)

Parameter | Description
color, clr | Specifies the color of the line.
startcolumn, XStart | Specifies the column in pixel units where the line should start on the live video.
startrow, YStart | Specifies the row in pixel units where the line should start on the live video.
endcolumn, XEnd | Specifies the column in pixel units where the line should end on the live video.
endrow, YEnd | Specifies the row in pixel units where the line should end on the live video.
Limitations:

Run time only. Only after ICImagingControl.LiveStart has been called once.
Example:

This example demonstrates how to draw a line on the live video.

Dim ob As OverlayBitmap
Set ob = ICImagingControl1.OverlayBitmap
ob.DrawLine RGB(255, 0, 0), 10,10, 10, 250
See also: OverlayBitmap, ICImagingControl.LiveStart

<< ICImagingControl.OverlayBitmap


OverlayBitmap::DrawSolidEllipse

OverlayBitmap.DrawSolidEllipse Method
This method draws a solid, filled ellipse on the live video.
Syntax:
Public Sub DrawSolidEllipse( color As Long, x0 As Long, y0 As Long, x1 As Long, y1 As Long )

Parameter | Description
clr | Specifies the color of the ellipse.
x0 | Specifies the column in pixel units of the of the upper left hand corner of the bounding rectangle of the ellipse on the live video.
y0 | Specifies the row in pixel units of the of the upper left hand corner of the bounding rectangle of the ellipse on the live video.
x1 | Specifies the column in pixel units of the of the lower right hand corner of the bounding rectangle of the ellipse on the live video.
y1 | Specifies the row in pixel units of the of the lower right hand corner of the bounding rectangle of the ellipse on the live video.
Limitations:

Run time only. Only after ICImagingControl.LiveStart has been called once.
Information:

Introduced in IC Imaging Control 2.0
Example:

This example demonstrates how to draw a solid green ellipse on the live video.

See also: OverlayBitmap, OverlayBitmap.DrawFrameEllipse, ICImagingControl.LiveStart

<< ICImagingControl.OverlayBitmap


OverlayBitmap::DrawText

OverlayBitmap.DrawText Method
This method draws text on the live video.
Syntax:

Public Sub DrawText( color As Long, column As Long, row As Long, text As String )

Parameter | Description
color, clr | Specifies the color of the text to be written.
column, XStart | Specifies the column in pixel units where the text should start on the live video.
row, YStart | Specifies the row in pixel units where the text should start on the live video
text | Specifies the text to be written.
Limitations:

Run time only. Only after ICImagingControl.LiveStart has been called once.
Remarks:

The method DrawText draws text on the live video. It uses the currently set Font, FontBackColor and the FontTransparent setting.

Example:

This example demonstrates how to draw text at the coordinates (10/10) on the live video.

Dim ob As OverlayBitmap
Set ob = ICImagingControl1.OverlayBitmap
' Print some text with red color.
ob.DrawText RGB(255, 0, 0), 10, 10, "IC Imaging Control"
See also: OverlayBitmap, OverlayBitmap.Font, OverlayBitmap.FontBackColor, OverlayBitmap.FontTransparent, ICImagingControl.LiveStart, ICImagingControl.LiveStop

<< ICImagingControl.OverlayBitmap


OverlayBitmap::Fill

OverlayBitmap.Fill Method
This method fills the entire overlay bitmap with the passed color.
Syntax:

Public Sub Fill( color As Long )

Parameter | Description
color, clr | Specifies the color used to fill the OverlayBitmap.
Limitations:

Run time only. Only after ICImagingControl.LiveStart has been called once.
Remarks:

The Fill method is used to fill an entire overlay bitmap with the passed color. This overwrites all previously drawn texts and graphics. If the dropout color is passed to the Fill method, there is no overlay on the video (as the overlay is empty). The Fill method is only successful, after ICImagingControl.LiveStart has been called once.

Example:

This example demonstrates how to fill the entire overlay bitmap with the dropout color.

Dim ob As OverlayBitmap
Set ob = ICImagingControl1.OverlayBitmap
' Enable the overlay bitmap for drawing.
ob.Enable = True
ICImagingControl1.LiveStart
' Set magenta as dropout color.
ob.DropOutColor = RGB(255, 0, 255)
' Fill the overlay bitmap with the dropout color.
ob.Fill ob.DropOutColor
See also: OverlayBitmap, OverlayBitmap.DropOutColor, ICImagingControl.LiveStart

<< ICImagingControl.OverlayBitmap


OverlayBitmap::GetDC

OverlayBitmap.GetDC Method
This method returns the device context of the OverlayBitmap object.
Syntax:

Public Function GetDC() As Long
Return Value:

A long value that contains the handle to the device context that is used in the OverlayBitmap. If an error occurs, the returned value is zero.

Limitations:

Run time only. Only after ICImagingControl.LiveStart has been called once.

Remarks:

If the returned device context is no longer used, an application must call OverlayBitmap.ReleaseDC to release the device context.

Example:

This Basic example demonstrates how to place a bitmap on the live video.

'
' ShowBitmap
'
' This sub demonstrates how to use OverlayBitmap.GetDC to blit a bitmap
' from a file on the live video.
' The bitmap will be blitted with transparency on the live video because
' it's background color is magenta (load the image "Hardware.BMP"
' with "Paint.exe" to verify this). Magenta is the currently set
' dropout color. The used GDI graphic functions are based on pixel units.
' Therefore, the scaling functions of Visual Basic are called to get the
' size of the loaded bitmap in pixels.
'
Private Sub ShowBitmap(ob As OverlayBitmap)
    Dim Pic As New StdPicture
    Dim PicWidth As Integer
    Dim PicHeight As Integer
    Dim obDC As Long
    Dim SourceDC As Long
    Dim Col As Integer

    ' Load a BMP file.
    Set Pic = LoadPicture(App.Path & "\hardware.bmp")

    ' Transform the size of the picture from himetric to pixel units.
    PicWidth = ScaleX(Pic.Width, vbHimetric, vbPixels)
    PicHeight = ScaleX(Pic.Height, vbHimetric, vbPixels)

    ' Calculate a column to display the bitmap in the
    ' upper right corner of Imaging Control.
    Col = ICImagingControl1.Width - 5 - PicWidth

    ' Get the DC of the OverlayBitmap object.
    obDC = ob.GetDC
    If obDC <> 0 Then
        ' Create a compatible DC that is used to hold the loaded bitmap.
        SourceDC = CreateCompatibleDC(obDC)
        If SourceDC <> 0 Then
            ' Select the loaded bitmap in the source DC.
            SelectObject SourceDC, Pic.handle

            ' Now blit the source DC in the overlay bitmap DC.
            ' This copies the loaded bitmap to the overlay bitmap.
            BitBlt obDC, Col, 5, PicWidth, PicHeight, _
                    SourceDC, 0, 0, 13369376  ' 13369376 is SRCCOPY

            ' Delete the DC source that is no longer needed to avoid handle leaks.
            DeleteDC SourceDC
        End If

        ' Release the DC.
        ob.ReleaseDC obDC
    End If
End Sub

The example uses functions from the Windows GDI library. They must be declared on top the form as follows.

' The GDI (graphics device interface) functions
' must be declared before they can be used.
Private Declare Function CreateCompatibleDC Lib "gdi32.dll" _
                          (ByVal handle As Long) As Long

Private Declare Function DeleteDC Lib "gdi32.dll" _
                          (ByVal handle As Long) As Long

Private Declare Function SelectObject Lib "gdi32.dll" _
                          (ByVal DC As Long, ByVal HGDIObj As Long) As Long

Private Declare Function BitBlt Lib "gdi32.dll" ( _
                              ByVal hdcDest As Long, _
                              ByVal nXDest As Long, _
                              ByVal nYDest As Long, _
                              ByVal nWidth As Long, _
                              ByVal nHeight As Long, _
                              ByVal hdcSrc As Long, _
                              ByVal nXSrc As Long, _
                              ByVal nYSrc As Long, _
                              ByVal dwRop As Long _
                              ) As Boolean
See also: OverlayBitmap, OverlayBitmap.ReleaseDC, ICImagingControl.LiveStart

<< ICImagingControl.OverlayBitmap


OverlayBitmap::ReleaseDC

OverlayBitmap.ReleaseDC Method
This method releases the device context of the OverlayBitmap object.
Syntax:

Public Sub ReleaseDC( hdc As Long )

Parameter | Description
hdc | Specifies the DC to release.
Limitations:

Run time only. Only after ICImagingControl.LiveStart has been called once.

Remarks:

If a device context is no longer used, an application must call ReleaseDC to release it. Not releasing a device context causes handle leaks.

Example:

This Basic example demonstrates how to retrieve and release the device context used by the OverlayBitmap object

Dim ob As OverlayBitmap
Dim obDC As Long
Set ob = ICImagingControl1.OverlayBitmap
obDC = ob.GetDC
If obDC <> 0 Then
    ' Some GDI graphic functions can be performed now.
    ob.ReleaseDC obDC
End If
See also: OverlayBitmap, OverlayBitmap.GetDC

<< ICImagingControl.OverlayBitmap


VideoFormat

A VideoFormat object contains information about a video format supported by the current video capture device.

A VideoFormat can be obtained out of the VideoFormats collection.

Example

This example illustrates how to obtain the first available video format.

Dim VidFmt As VideoFormat
Set VidFmt = ICImagingControl1.VideoFormats.Item( 1 )

Information

Introduced in IC Imaging Control 1.x

Properties

Property | Description
BitsPerPixel | Returns the bits per pixel of the VideoFormat. The byte count per pixel is calculated by dividing the bits per pixel count by 8.
Height | Returns the height of the VideoFormat.
Name | Returns the name of the VideoFormat.
Width | Returns the width of the VideoFormat.

<< Classes


VideoFormat::BitsPerPixel

VideoFormat.BitsPerPixel Property
Returns the bits per pixel of the VideoFormat. The byte count per pixel is calculated by dividing the bits per pixel count by 8.
Syntax:
Public BitsPerPixel As Long
Limitations:

Read only.
Remarks:

Selecting devices, input channels, video norms and video formats is shown in the Making Device Settings chapter.

See also: VideoFormat, VideoFormat.Width, VideoFormat.Height, VideoFormats Collection

<< ICImagingControl.VideoFormat


VideoFormat::Height

VideoFormat.Height Property
Returns the height of the VideoFormat.
Syntax:
Public Height As Long
Limitations:

Read only.
Remarks:

Selecting devices, input channels, video norms and video formats is shown in the Making Device Settings chapter.

See also: VideoFormat, VideoFormat.Width, VideoFormat.BitsPerPixel, VideoFormats Collection

<< ICImagingControl.VideoFormat


VideoFormat::Name

VideoFormat.Name Property
Returns the name of the VideoFormat.
Syntax:
Public Name As String
Limitations:

Read only.
Remarks:

Selecting devices, input channels, video norms and video formats is shown in the Making Device Settings chapter.

Sample:

This example selects the first available video format.

Dim Fmt As VideoFormat
Set Fmt = ICImagingControl1.VideoFormats.Item( 1 )
ICImagingControl1.VideoFormat = Fmt.Name1
See also: VideoFormat, VideoFormats Collection

<< ICImagingControl.VideoFormat


VideoFormat::Width

VideoFormat.Width Property
Returns the width of the VideoFormat.
Syntax:
Public Width As Long
Limitations:

Read only.
Remarks:

Selecting devices, input channels, video norms and video formats is shown in the Making Device Settings chapter.

See also: VideoFormat, VideoFormat.Height, VideoFormat.BitsPerPixel, VideoFormats Collection

<< ICImagingControl.VideoFormat


VideoFormats

VideoFormats is a collection of VideoFormat objects. A VideoFormats collection is used to obtain the available video formats of the current video capture device. The ICImagingControl.VideoFormats property returns a VideoFormats collection.

Example

This example shows how to fill a combo box with the available video formats:

Dim VidFmtCol As VideoFormats
Dim VidFmt As VideoFormat
Set VidFmtCol = ICImagingControl1.VideoFormats

For Each VidFmt In VidFmtCol
    cboVideoFormatComboBox.AddItem VidFmt.Name
Next

Properties

Property | Description
Count | Returns the count of VideoFormat objects in the collection.
Item | Returns the VideoFormat at the specified position.

Methods

Method | Description
FindIndex | Searches the collection for a given string. The string contains the name of a video format.

<< Classes


VideoFormats::Count

VideoFormats.Count Property
Returns the count of VideoFormat objects in the collection.
Syntax:
Public Count As Long
Limitations:

Read only.
Sample:

This example determines whether video formats are available:

Dim VidFmtCol As VideoFormats
Set VidFmtCol = ICImagingControl1.VideoFormats
If VidFmtCol.Count > 0 then
    ' do something
else
    ' no video formats available
End If
See also: VideoFormats, VideoFormat, VideoFormats.Item, VideoFormats.FindIndex

<< ICImagingControl.VideoFormats


VideoFormats::Item

VideoFormats.Item Property
Returns the VideoFormat at the specified position.
Syntax:
Public Item(Index As Long) As VideoFormat

Parameter | Description
Index | Specifies the Index of the VideoFormat to return. The Index must lie in int the range [1, VideoFormats.Count ], otherwise an error occurs.
Limitations:

Read only.
Sample:

This example selects the first available video format:

Dim VidFmtCol As VideoFormat
Set VidFmtCol = ICImagingControl1.VideoFormats
ICImagingControl1.VideoFormat = VidFmtCol.Item( 1 )
See also: VideoFormats, VideoFormat, VideoFormats.Count, VideoFormats.FindIndex

<< ICImagingControl.VideoFormats


VideoFormats::FindIndex

VideoFormats.FindIndex Method
Searches the collection for a given string. The string contains the name of a video format.
Syntax:
Public Function FindIndex(Name As String) As Long

Parameter | Description
Name | Specifies the name of the video format for which to search in the collection.
Return Value:

If the property Name of an VideoFormat object is equal to the given string, the FindIndex method returns the index of this object in the collection. If the string is not found, the FindIndex method returns -1.

Sample:

This example tests whether the "RGB24 (320x240)" video format is available:

Dim VidFmtCol As VideoFormats
Dim Index As long
Set VidFmtCol = ICImagingControl1.VideoFormats
Index = VidFmtCol.FindIndex("RGB24 (320x240)")
If Index = -1 Then
    ' video format not available
Else
    ' do something
End If
See also: VideoFormats, VideoFormat, VideoFormats.Count, VideoFormats.Item

<< ICImagingControl.VideoFormats


VideoNorm

A VideoNorm object contains information about a video norm supported by the current video capture device.

A VideoNorm can be obtained out of the VideoNorms collection.

Example

This example illustrates how to obtain the first available video norm.

Dim VidNorm As VideoNorm
Set VidNorm = ICImagingControl1.VideoNorms.Item( 1 )

Information

Introduced in IC Imaging Control 1.x

Properties

Property | Description
Name | Returns the name of the VideoNorm.

<< Classes


VideoNorm::Name

VideoNorm.Name Property
Returns the name of the VideoNorm.
Syntax:
Public Name As String
Limitations:

Read only.
Remarks:

Selecting devices, input channels, video norms and video formats is shown in the Making Device Settings chapter.

Sample:

This example selects the first available video norm.

Dim Nrm As VideoNorm
Set Nrm = ICImagingControl1.VideoNorms.Item( 1 )
ICImagingControl1.VideoNorm = Nrm.Name1
See also: VideoNorm, VideoNorms Collection

<< ICImagingControl.VideoNorm


VideoNorms

VideoNorms is a collection of VideoNorm objects. A VideoNorms collection is used to obtain the available video norms of the current video capture device. The ICImagingControl.VideoNorms property returns a VideoNorms collection.

Example

This example shows how to fill a combo box with the available video norms:

Dim VidNrmCol As VideoNorms
Dim VidNrm As VideoNorm
Set VidNrmCol = ICImagingControl1.VideoNorms

For Each VidNrm In VidNrmCol
    cboVideoNormComboBox.AddItem VidNrm.Name
Next

Properties

Property | Description
Count | Returns the count of VideoNorm objects in the collection.
Item | Returns the VideoNorm at the specified position.

Methods

Method | Description
FindIndex | Searches the collection for a given string. The string contains the name of a video norm.

<< Classes


VideoNorms::Count

VideoNorms.Count Property
Returns the count of VideoNorm objects in the collection.
Syntax:
Public Count As Long
Limitations:

Read only.
Example:

This example determines whether video norms are available:

Dim VidNrmCol As VideoNorms
Set VidNrmCol = ICImagingControl1.VideoNorms
If VidNrmCol.Count > 0 then
    ' do something
else
    ' no video norms available
End If
See also: VideoNorms, VideoNorm, VideoNorms.Item, VideoNorms.FindIndex

<< ICImagingControl.VideoNorms


VideoNorms::Item

VideoNorms.Item Property
Returns the VideoNorm at the specified position.
Syntax:
Public Item(Index As Long) As VideoNorm

Parameter | Description
Index | Specifies the Index of the VideoNorm to return. The Index must lie in int the range [1, VideoNorms.Count ], otherwise an error occurs.
Limitations:

Read only.
Example:

This example selects the first available video norm:

Dim VidNrmCol As VideoNorms
Set VidNrmCol = ICImagingControl1.VideoNorms
ICImagingControl1.VideoNorm = VidNrmCol.Item( 1 )
See also: VideoNorms, VideoNorm, VideoNorms.Count, VideoNorms.FindIndex

<< ICImagingControl.VideoNorms


VideoNorms::FindIndex

VideoNorms.FindIndex Method
Searches the collection for a given string. The string contains the name of a video norm.
Syntax:
Public Function FindIndex(Name As String) As Long

Parameter | Description
Name | Specifies the name of the video norm for which to search in the collection.
Return Value:

If the property Name of an VideoNorm object is equal to the given string, the FindIndex method returns the index of this object in the collection. If the string is not found, the FindIndex method returns -1.

Example:

This example tests whether the "NTSC_M" video norm is available:

Dim VidNrmCol As VideoNorms
Dim Index As long
Set VidNrmCol = ICImagingControl1.VideoNorms
Index = VidNrmCol.FindIndex("NTSC_M")
If Index = -1 Then
    ' video norm not available
Else
    ' do something
End If
See also: VideoNorms, VideoNorm, VideoNorms.Count, VideoNorms.Item

<< ICImagingControl.VideoNorms


Enumerations

Complete list of all enumerations.

Enumerations

Enumeration | Description
AbsDimFunction | tAbsDimFunction enumerates all the possible dimension functions. The dimension functions describe how to map slider values to property values to achieve the best usability for your programs.
BaseSinkTypes | The BaseSinkTypes enumeration members identify the sink types.
DeBayerModes | The DeBayerModes enumeration is used to set the debayering algorithm.
DeBayerStartPatterns | Enumeration containing all possible bayer start patterns of the first row of the image data.
ExternalTransportModes | The ExternalTransportModes represent the modes that can set, by calling ICImagingControl.ExternalTransportMode
ICImagingControlColorformats | The ICImagingControlColorformats represent the formats that specify the pixel depth of all image buffers. The pixel depth of all image buffers is set with a call to ICImagingControl.MemoryCurrentGrabberColorformat
OverlayColorModes | The members of this enumeration are used to set the color format of the OverlayBitmap, using OverlayBitmap.ColorMode.
PathPositions | PathPositions enumerates the possible positions of the OverlayBitmap in the image stream.

<< Reference


refenum::AbsDimFunction

refenum.AbsDimFunction
tAbsDimFunction enumerates all the possible dimension functions. The dimension functions describe how to map slider values to property values to achieve the best usability for your programs.
Name | Description
eAbsDimFunc_Linear | The dimension function is linear.
eAbsDimFunc_Log | The dimension function is logarithmic.
eAbsDimFunc_Other | The dimension function is of another type. This is currently not defined, if you encounter this value use linear mapping instead.

<< Enumerations


refenum::ExternalTransportModes

refenum.ExternalTransportModes
The ExternalTransportModes represent the modes that can set, by calling ICImagingControl.ExternalTransportMode
Name | Description
ET_MODE_PLAY | Play
ET_MODE_STOP | Stop
ET_MODE_FREEZE | Pause
ET_MODE_REWIND | Rewind
ET_MODE_FASTFORWARD | Fast forward

<< Enumerations


refenum::ICImagingControlColorformats

refenum.ICImagingControlColorformats
The ICImagingControlColorformats represent the formats that specify the pixel depth of all image buffers. The pixel depth of all image buffers is set with a call to ICImagingControl.MemoryCurrentGrabberColorformat
Name | Description
ICRGB32 | 32 bit color depth
ICRGB24 | 24 bit color depth
ICRGB565 | 16 bit color depth with red 5 green 6 blue 5 bit encoding
ICRGB555 | 16 bit color depth with red 5 green 5 blue 5 bit encoding
ICY8 | 8 bit grayscale, bottom up
ICUYVY | UYVY color format
eY800 | 8 bit Y format, top down
eYGB0 | 16 bit Y (10 bit valid) format
eYGB1 | 16 bit Y (10 bit valid) format
eBY8 | 8 bit bayer raw format. See Debayering for information on how to handle this format.

<< Enumerations


IC Imaging Control Standard Filters

IC Imaging Control comes with several standard frame filters. They can be explored with the Filter Inspector application.

The frame filter module stdfilters.ftf contains four filters:

  • DeBayer: Converts raw image data to RGB
  • DeNoise: Denoising by image integration
  • ROI: Region of Interest
  • Rotate Flip: Rotation and Flipping
  • Bayer to Y800: Converts BY8 to Y800

Module Files

The module file stdfilters.ftf is located in the classlib\release directory and the ICImagingControl.ocx's directory (common files directory). The debug compiled version of the module is named stdfiltersd.ftf and is located in the classlib\debug directory of the IC Imaging Control installation path.

Bayer to Y800 Filter

The Bayer to Y800 filter reinterprets the raw color data in BY8 images as Y800. Using this filter, it is possible to display the raw color data. The BY8 image data is de-bayered automatically before the video stream is rendered on screen.

DeBayer Filter

The DeBayer filter is used to convert raw image data into an RGB image. In a raw color image, every pixel represents a value for one basic color, instead of three as is the case for an RGB image. In order to get a real color image, the two missing colors have to be interpolated. This is exactly what this filter does.

DeNoise Filter

The DeNoise filter reduces noise in the frames by averaging a number of frames.

ROI Filter

The ROI filter cuts a region of interest out of the incoming frames. It creates a new output video format.

Rotate Flip Filter

The Rotate Flip filter allows image data to be flipped and rotated in steps of 90 degrees.

<< IC Imaging Control ActiveX User's Guide


Bayer to Y800 Filter

The Bayer to Y800 filter reinterprets the raw color data in BY8 images as Y800. Using this filter, it is possible to display the raw color data. The BY8 image data is de-bayered automatically before the video stream is rendered on screen.

Using the Bayer to Y800 Filter

The Bayer to Y800 filter is loaded by an application using following code:

Dim BY8toY800Filter As FrameFilter
Set BY8toY800Filter = ICImagingControl1.FrameFilterCreateString("Bayer to Y800", "stdfilters.ftf")

Parameters

The Bayer to Y800 filter does not have any parameters.

Property Dialog

The Bayer to Y800 filter does not have a property dialog.

<< IC Imaging Control Standard Filters


DeBayer Filter

The DeBayer filter is used to convert raw image data into an RGB image. In a raw color image, every pixel represents a value for one basic color, instead of three as is the case for an RGB image. In order to get a real color image, the two missing colors have to be interpolated. This is exactly what this filter does.

Using the DeBayer Filter

The DeBayer filter is loaded by an application using the following code:

Dim DeBayerFilter As FrameFilter
Set DeBayerFilter = ICImagingControl1.FrameFilterCreateString("DeBayer", "stdfilters.ftf")

Parameters

There are two parameters that control the de-bayering process:

Start Pattern
The parameter Start Pattern defines how the Bayer Mosaic pattern in the raw image data is to be interpreted.
Available start patterns are:
  • BG: The raw image data starts with a blue/green line. Set Start Pattern to 0.
  • GB: The raw image data starts with a green/blue line. Set Start Pattern to 1.
  • GR: The raw image data starts with a green/red line. Set Start Pattern to 2.
  • RG: The raw image data starts with a red/green line. Set Start Pattern to 3.
Mode
The Mode parameter selects the algorithm used to de-bayer the raw image data.
Available algorithms are:
  • Nearest Color: Simple and fast algorithm, but rather bad output image quality. Set Mode to 0.
  • Bilinear: Fast algorithm producing good output image quality. Set Mode to 1.
  • Edge Sensing: This algorithm has the best output image quality but is rather slow. Set Mode to 2.

If the algorithm should be set programmatically, then following code can be used:

' Retrieve the current mode.
Dim mode As Long
mode = DeBayerFilter.Parameter("Mode")

' Set a new Mode.
mode = 1
DeBayerFilter.Parameter("Mode") = mode

Property Dialog

All parameters can be accessed using the built-in property dialog. The property dialog of the DeBayer filter is as follows:

<< IC Imaging Control Standard Filters


DeNoise Filter

The DeNoise filter reduces noise in the frames by averaging a number of frames.

Using the DeNoise Filter

The DeNoise filter is loaded by an application using the following code:

Dim DeNoiseFilter As FrameFilter
Set DeNoiseFilter = ICImagingControl1.FrameFilterCreateString("DeNoise", "stdfilters.ftf")

Parameters

The only parameter of the DeNoise filter is the DeNoise Level:

DeNoise Level
The parameter DeNoise Level determines the number of frames to be averaged.
Note: The actual number of frames that are averaged is 2^n, so when setting DeNoise Level to 2, 4 frames are averaged.
This parameter can only be set while the live video stream is stopped.

Property Dialog

The number of frames to be averaged can be adjusted in the filter's property dialog:

Programmatically Access the Parameter

The following source code can be used, if the parameter should be set by an application:

' Retrieve the current denoise level.
Dim level As Long
level = DeNoiseFilter.Parameter("DeNoise Level")

' Set a new denoise level.
level = 3
If Not ICImagingControl1.LiveVideoRunning Then
    ' A new denoise level can only be set, while the live video is stopped.
    DeNoiseFilter.Parameter("DeNoise Level2") = level
End If

<< IC Imaging Control Standard Filters


ROI Filter

The ROI filter cuts a region of interest out of the incoming frames. It creates a new output video format.

Using the ROI Filter

The ROI filter is loaded by an application using following code:

Dim ROIFilter As FrameFilter
Set ROIFilter = ICImagingControl1.FrameFilterCreateString("ROI", "stdfilters.ftf")

Parameters

The part of the image that is copied to the destination frame is determined by four filter parameters:

Left
This value specifies the left column on the source frame at which the region of interest (ROI) starts. This value is used to move the region of interest horizontally to the source frame. It can be changed regardless of whether the live video is running or not.
Top
This value specifies the top row on the source frame at which the region of interest starts. This value is used to move the region of interest vertically to the source frame. It can be changed regardless of whether the live video is running or not.
Width
This value specifies the width of the region of interest. It can only be set while the live video is stopped. Otherwise, the resulting video format would be changed.
The width will be aligned to eight pixels in the filter.
Height
This value specifies the height of the region of interest. It can only be set while the live video is stopped. Otherwise, the resulting video format would be changed.

Property Dialog

The dimensions and the start positions of the region of interest can be specified in the ROI filter's property dialog:

Programmatically Access the Parameter

The following source code can be used, if the parameter should be set by an application:

Dim left As Long
Dim top As Long
Dim height As Long
Dim width As Long

' Retrieve the current ROI rectangle.
left = ROIFilter.Parameter("Left")
top = ROIFilter.Parameter("Top")
height = ROIFilter.Parameter("Height")
width = ROIFilter.Parameter("Width")

' Set a new ROI.
left = 100
top = 50
' The position of the ROI can be set regardless of whether the live video is running
' because the size of the resulting video format is not changed.
ROIFilter.Parameter("Left") = left
ROIFilter.Parameter("Top") = top

If Not ICImagingControl1.LiveVideoRunning Then
    ' A new ROI width and height can only be set, while the live video ist stopped.
    ' Otherwise, an error is returned by setParameter().
    height = 120
    width = 180
    ROIFilter.Parameter("Height") = height
    ROIFilter.Parameter("Width") = width
End If

<< IC Imaging Control Standard Filters


Rotate Flip Filter

The Rotate Flip filter allows image data to be flipped and rotated in steps of 90 degrees.

Using the Rotate Flip Filter

The Rotate Flip filter is loaded by an application using the following code:

Dim RotateFlipFilter As FrameFilter
Set RotateFlipFilter = ICImagingControl1.FrameFilterCreateString("Rotate Flip", "stdfilters.ftf")

Parameters

The part of the image that is copied to the destination frame is determined by four filter parameters:

Rotation Angle
This parameter sets the rotation angle.
Available angles are:
  • 0°
  • 90°
  • 180°
  • 270°
Please note that this parameter can only be changed in steps of 180° when live mode is running. Otherwise, the changes would alter the output video format.
Flip V
This parameter determines whether the image should be flipped vertically. As it is a boolean parameter, valid values are true and false. The setting of the flip parameters does not cause a video format change. Thus, they can be set regardless of whether the live video is running or not.
Flip H
This parameter determines whether the image should be flipped horizontally. As it is a boolean parameter, valid values are true and false. The setting of the flip parameters does not cause a video format change. Thus, they can be set regardless of whether the live video is running or not.

Property Dialog

The rotation angle and flipping modes can be specified in the filter's property dialog:

Programmatically Access the Parameters

If the parameters should be set by an application, following source code can be used:

Dim angle As Long
Dim newAngle As Long
Dim flipVertical As Boolean
Dim flipHorizontal As Boolean

' Retrieve the current parameter settings:
angle = RotateFlipFilter.Parameter("Rotation Angle")
flipVertical = RotateFlipFilter.Parameter("Flip V")
flipHorizontal = RotateFlipFilter.Parameter("Flip H")

' Change the parameters.
newAngle = 90 ' Only the values 0, 90, 180, 270 are allowed.

' If the rotation value is 90 or 270, then the resulting video format
' is changed. Thus, the new value can only be set while the live video is
' stopped. Otherwise, an error is returned.
If Abs(angle - newAngle) = 90 Or Abs(angle - newAngle) = 270 Then
    If Not ICImagingControl1.LiveVideoRunning Then
        RotateFlipFilter.Parameter("Rotation Angle") = newAngle
    End If
Else
    RotateFlipFilter.Parameter("Rotation Angle") = newAngle
End If

' The flip parameters do not cause a video format change, so they can be
' set regardless of whether the live video is running.
flipVertical = True
flipHorizontal = True
RotateFlipFilter.Parameter("Flip V") = flipVertical
RotateFlipFilter.Parameter("Flip H") = flipHorizontal

<< IC Imaging Control Standard Filters