Exposure Absolute Values

Blogged by Stefan Geißler on March 31, 2008.

Very often, I am asked how to access the Absolute Values interface of the exposure time. Although this seems to be complicated at first glace, it is not:

The interface is accessed in the following three steps:

  1. Declare the necessary variables for the interfaces.
  2. Query the interfaces.
  3. Work with the queried interfaces.

Declare the variables for the interfaces

We need a variable for the interface to toggle automatic exposure and a variable for the exposure values interface.

VB:

Dim AbsoluteValues As ICImagingControl3.VCDAbsoluteValueProperty
Dim ExposureAuto As ICImagingControl3.VCDSwitchProperty
    

C#:

using TIS.Imaging;
ICImagingControl3.VCDAbsoluteValueProperty AbsoluteValues;
ICImagingControl3.VCDSwitchProperty ExposureAuto;
    

Query the interfaces

This step is quite simple. The only thing you have to do is gather the required information:

VB:

AbsoluteValues = IcImagingControl1.VCDPropertyItems.FindInterface( 
                                           VCDIDs.VCDID_Exposure + ":" + _
                                           VCDIDs.VCDElement_Value + ":" + _
                                           VCDIDs.VCDInterface_AbsoluteValue)

ExposureAuto = IcImagingControl1.VCDPropertyItems.FindInterface( 
                                           VCDIDs.VCDID_Exposure + ":" + _
                                           VCDIDs.VCDElement_Auto + ":" + _
                                           VCDIDs.VCDInterface_Switch)
    

C#:

AbsoluteValues = (ICImagingControl3.VCDAbsoluteValueProperty)icImagingControl1.VCDPropertyItems.FindInterface(
                                                     VCDIDs.VCDID_Exposure + ":" +
                                                     VCDIDs.VCDElement_Value + ":" +
                                                     VCDIDs.VCDInterface_AbsoluteValue);
                                                     
ExposureAuto = (ICImagingControl3.VCDSwitchProperty) icImagingControl1.VCDPropertyItems.FindInterface( 
                                                     VCDIDs.VCDID_Exposure + ":" +
                                                     VCDIDs.VCDElement_Auto + ":" +
                                                     VCDIDs.VCDInterface_Switch);
    

Work with the queried interfaces

Now we can check, whether the interfaces exist and query their values.

VB:

    'Disable automatic
If Not ExposureAuto Is  Nothing Then
	ExposureAuto.Switch = false
End If


If Not AbsoluteValues Is  Nothing Then
	Dim ExposureMin As Double
	Dim ExposureMax As Double
	Dim ExposureValue As Double

	' Query the currently set values:
	ExposureMax = AbsoluteValues.RangeMax
	ExposureMin = AbsoluteValues.RangeMin
	ExposureValue = AbsoluteValues.Value

	'Set a new exposure value
	AbsoluteValues.Value = 0.002
End if

C#:

// If ExposureAuto exposure exists ...
if (ExposureAuto != null)
{
	//... make sure, it is disabled.
	ExposureAuto.Switch = false;
}


// If the absolute values interface exists...
if (AbsoluteValues != null)
{
	double ExpMin, ExpMax, ExpCurrent;

	// ... query the currenty values:
	ExpMin = AbsoluteValues.RangeMin;
	ExpMax = AbsoluteValues.RangeMax;
	ExpCurrent = AbsoluteValues.Value;

	//.. set a new value
	AbsoluteValues.Value = 0.001;

}

Please keep in mind that not all cameras and video capture devices support the Absolute Values interface.

Permalink

Tagged with VCD Properties, Exposure, Absolute Values and interface.

USB Camera Driver Updated

Blogged by Stefan Geissler on December 13, 2007.

The new driver version 1.0.0.15 is now available at http://www.theimagingsource.com.

Following Windows® versions are supported:

  • XP SP2
  • XP 64bit
  • Vista® 32bit
  • Vista® 64bit

The Windows® standard USB video driver can be used for the DFK 21AU04 and DFK 21BU04 cameras. But this driver does not offer the full range of available camera properties.

The monochrome and the higher resolution cameras such as DFK 31AU03 or DMK 21BU04 need the TIS WDM driver. The Windows® standard USB video driver simply shows a "Code 10, device can not start" error for them in the Device Manager.

All WDM drivers for The Imaging Source video capture devices (converters, grabbers, DCam cameras and USB cameras) support Windows Vista® 32 and 64 bit.

Permalink

Tagged with USB, camera, driver, download, Code 10 and Vista.

Visual Studio® 2008 is available

Blogged by Stefan Geissler on December 11, 2007.

The new Visual Studio® 2008 is now available. We have tested the compatibility of IC Imaging Control Classlibrary and .NET component with Visual Studio® 2008.

The current version of IC Imaging Control 3.0.5 Classlibrary is incompatible to Visual Studio® 2008.

IC Imaging Control .NET 3.0.5 component works fine in Visual Studio® 2008 in Windows XP®, but not in Visual Studio® 2008 in Windows Vista®.The IC .NET component 3.0.5 runs fine in Visual Studio® 2005 in Windows Vista®.

The next version of IC Imaging Control that is fully compatible to Visual Studio® 2008 in Windows XP® and Windows Vista® is already in the pipeline. We hope it will be finished soon.

Permalink

Tagged with C++, compatibility, NET, 2008 and Vista.

How to Display the Property Pages of a Camera

Blogged by Stefan Geißler on October 02, 2007.

Users of IC Imaging Control Professional often inquire how to show the property dialog box that ships with the driver of their video capture device. Typically, this dialog box allows access to certain special properties that are not accessible through IC Imaging Control. The IC Imaging Control Grabber object exports an IUnknown COM pointer that can be used to access the driver's dialog box.

The following C++ code shows the driver's dialog box.

smart_com<IUnknown> pksps = 0;
m_cGrabber.getDev().getInternalInterface( pksps );

if( pksps != NULL )
{
    HRESULT hr;
    smart_com<ISpecifyPropertyPages> pSpec;
    hr = pksps->QueryInterface(IID_ISpecifyPropertyPages, (void **)&pSpec.get());
    if (hr == S_OK)
    {
        CAUUID cauuid;
        hr = pSpec->GetPages(&cauuid);
        if( SUCCEEDED( hr ) && cauuid.cElems > 0 && cauuid.pElems != 0 )
        {
            hr = OleCreatePropertyFrame( this->m_hWnd, 30, 30, 0, 1, &pksps.getImpl(), cauuid.cElems,
                (GUID *)cauuid.pElems, 0, 0, 0);

            CoTaskMemFree(cauuid.pElems);
        }
    }
}

Permalink

Tagged with C++, property page, driver and professional.

Service Pack 2 for IC Imaging Control released

Blogged by Stefan Geißler on September 19, 2007.

Service Pack 2 for IC Imaging Control installs the IC application wizards for Visual Studio 2005. The wizards allow you to create new imaging applications within a few mouse clicks. The following languages are supported:

  • C++
  • C#
  • Visual Basic

Please download and install the service pack as soon as possible.

Permalink

Tagged with application, wizard, C#, Visual Basic and development.

New Sample for Finding a Laser Point

Blogged by Stefan Geißler on July 31, 2007.

We have just released a brief sample application that illustrates how to locate a laser point on a live video and return its coordinates.

Permalink

Tagged with point, laser, find and C#.

Changing the Mouse Cursor

Blogged by Stefan Geißler on July 05, 2007.

Changing the mouse cursor in IC Imaging Control is a task that has caused problems for several of our customers. Indeed, it is an issue that regularly comes to my attention in the support department.

In order to resolve some of the confusion that shrouds this relatively simple task, I have created a C# and VB.NET sample application. With the help of one DLL, changing the mouse cursor in IC Imaging Control was never easier!

This new sample application is documented in detail in the Source Code Library:

Permalink

Tagged with cursor, C#, Visual Basic and mouse.

Iterating Through a Captured Image Sequence

Blogged by Stefan Geißler on July 02, 2007.

I have just published a new sample application that illustrates how the last two seconds leading up to an unknown event can be captured to an image sequence. After this event has occurred, the end-user can iterate manually or automatically through the captured images.

The following animated screenshot shows how to use a slider to iterate through the previously captured image sequence:

Image of the sample.

This new sample application is documented in detail in the Source Code Library:

Permalink

Tagged with image, sequence, capture and event.

Service Pack 1 for IC Imaging Control 3.0 Released

Blogged by Stefan Geißler on June 22, 2007.

We have recently released the first service pack for IC Imaging Control 3.0.4, which fixes the following minor issues:

  • If a frame filter chain is used with Visual Studio® C++ 6.0, an application crashes with a CRTIsValidHeapPointer() error, if more than one filter is used. The affected function is:
    DShowLib::tFrameFilterList CFilterChain;
    CFilterChain.push_back( DeBayerFilter.get() );
    CFilterChain.push_back( RoiFilter.get() ); // Here the crash occures.
    Only Visual Studio® C++ 6.0 is affected by this issue.
  • If in Windows Vista™, a DV device such as a DV camcorder is used, stopping the live video may lead to an application crash, while the same software runs fine in Windows XP™ and Windows 2000™.

Please download and install the service pack, if you are being affected by these issues.

Permalink

Tagged with C++, Filter, service pack, DV Camcorder and Vista.

Set a Region of Interest (ROI), while Displaying Live Video

Blogged by Stefan Geißler on April 23, 2007.

Often, programmers are required to use a region of interest (ROI) in a C++ application. The ROI should be changed depending upon the content of the live video. After speaking to several customers who are attempting something on these lines, I realized that generally, there is confusion in this area. I have, thus, created a little function that illustrates how to set ROI parameters. I hope that this helps relieve the confusion a little :-).

First of all, we perform a little sanity checking to ensure that the ROI Frame Filter is up and running:

if( m_pROIFilter.get() )  // Ensure the ROI filter has been loaded.
{
}

The dialog offers four input fields for the left, top, width and height parameters of the new ROI. These values are retrieved and saved in the local variables x, y, w and h respectively.

In order to avoid that the video output is too small, the contents of w and h are limited to a minimum value of 10:

int x,y,w,h;
bool bRestartVideo = false;

// Get the values from the edit fields
x = ::GetDlgItemInt(this->m_hWnd,IDC_EDITROIX,NULL,TRUE);
y = ::GetDlgItemInt(this->m_hWnd,IDC_EDITROIY,NULL,TRUE);
w = ::GetDlgItemInt(this->m_hWnd,IDC_EDITROIWIDTH,NULL,TRUE);
h = ::GetDlgItemInt(this->m_hWnd,IDC_EDITROIHEIGHT,NULL,TRUE);

// Avoid too small live video
if( w < 10 ) w = 10;
if( h < 10 ) h = 10;

Additionally, we need a boolean variable that is set to true, if the live video must be started after we change the ROI. The variable is called bRestartVideo.

In the next step, we need to stop the live video, if it is running. This is necessary, as the size of the output video format is going to be changed. This also affects the size of IC Imaging Control's images buffers.

// Check for a running live video. It must be stopped, before the new
// ROI can be set.
if( m_cGrabber.isDevValid() )
{
    if( m_cGrabber.isLive() )
    {
        bRestartVideo = true; // Set to true, so the live video will be restarted later.
        m_cGrabber.stopLive();
    }
}

Next, the four new values for the ROI are passed to the ROI Frame Filter:

m_pROIFilter->beginParamTransfer();
m_pROIFilter->setParameter("Left",x);
m_pROIFilter->setParameter("Top",y);
m_pROIFilter->setParameter("Width",w);
m_pROIFilter->setParameter("Height",h);
m_pROIFilter->endParamTransfer();

In the case that the live video was previously running, it is restarted in the final step:

// If a live video was running, restart it.
if( bRestartVideo )
{
    m_cGrabber.startLive();
}

Below is the source code in its entirety. It was implemented as a button handler function in the sample application:

//////////////////////////////////////////////////////////////////////////
// OnBnClickedButtonsetroi
//
// Set the ROI to the values entered in the fields on the dialog.
//
void CSampleDlg::OnBnClickedButtonsetroi()
{
    if( m_pROIFilter.get() ) // Ensure the ROI filter has been loaded.
    {
        int x,y,w,h;
        bool bRestartVideo = false;

        // Get the values from the edit fields
        x = ::GetDlgItemInt(this->m_hWnd,IDC_EDITROIX,NULL,TRUE);
        y = ::GetDlgItemInt(this->m_hWnd,IDC_EDITROIY,NULL,TRUE);
        w = ::GetDlgItemInt(this->m_hWnd,IDC_EDITROIWIDTH,NULL,TRUE);
        h = ::GetDlgItemInt(this->m_hWnd,IDC_EDITROIHEIGHT,NULL,TRUE);
        
        // Avoid too small live video
        if( w < 10 ) w = 10;
        if( h < 10 ) h = 10;

        // Check for a running live video. It must be stopped, before the new
        // ROI can be set.
        if( m_cGrabber.isDevValid() )
        {
            if( m_cGrabber.isLive() )
            {
                bRestartVideo = true;
                m_cGrabber.stopLive();
            }
        }

        m_pROIFilter->beginParamTransfer();
        m_pROIFilter->setParameter("Left",x);
        m_pROIFilter->setParameter("Top",y);
        m_pROIFilter->setParameter("Width",w);
        m_pROIFilter->setParameter("Height",h);
        m_pROIFilter->endParamTransfer();

        // If a live video was running, restart it.
        if( bRestartVideo )
        {
            m_cGrabber.startLive();
        }

    }
}

Permalink

Tagged with C++, ROI, Region of Interest, Frame Filter, Class Library and Sample Application.