IC Imaging Control .NET

Controlling DV Devices

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 the VB.NET and C# versions of this sample program can be found in the directories samples\VB *\Controlling DV Devices and samples\C# *Controlling DV Devices in your My Documents/IC Imaging Control 3.4 directory.

image

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 Visual Studio .NET 2003 - 2008 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:

[VB.NET]
Private Sub cmdStart_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStart.Click IcImagingControl1.LiveStart() If IcImagingControl1.ExternalTransportAvailable = True Then cmdETPlay_Click(sender, e) End If End Sub
[C#]
private void cmdStart_Click(object sender, EventArgs e) { icImagingControl1.LiveStart(); if (icImagingControl1.ExternalTransportAvailable) { cmdETPlay_Click(sender, e); } }
[VB.NET]
Private Sub cmdStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdStop.Click IcImagingControl1.LiveStop() End Sub
[C#]
private void cmdStop_Click(object sender, EventArgs e) { icImagingControl1.LiveStop(); }

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.

[VB.NET]
Private Sub cmdETPlay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdETPlay.Click IcImagingControl1.ExternalTransportMode = TIS.Imaging.ExternalTransportModes.ET_MODE_PLAY End Sub
[C#]
private void cmdETPlay_Click(object sender, EventArgs e) { icImagingControl1.ExternalTransportMode = TIS.Imaging.ExternalTransportModes.ET_MODE_PLAY; }
[VB.NET]
Private Sub cmdETStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdETStop.Click IcImagingControl1.ExternalTransportMode = TIS.Imaging.ExternalTransportModes.ET_MODE_STOP End Sub
[C#]
private void cmdETStop_Click(object sender, EventArgs e) { icImagingControl1.ExternalTransportMode = TIS.Imaging.ExternalTransportModes.ET_MODE_STOP; }
[VB.NET]
Private Sub cmdETRewind_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdETRewind.Click IcImagingControl1.ExternalTransportMode = TIS.Imaging.ExternalTransportModes.ET_MODE_REWIND End Sub
[C#]
private void cmdETRewind_Click(object sender, EventArgs e) { icImagingControl1.ExternalTransportMode = TIS.Imaging.ExternalTransportModes.ET_MODE_REWIND; }
[VB.NET]
Private Sub cmdETFastForward_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdETFastForward.Click IcImagingControl1.ExternalTransportMode = TIS.Imaging.ExternalTransportModes.ET_MODE_FASTFORWARD End Sub
[C#]
private void cmdETFastForward_Click(object sender, EventArgs e) { icImagingControl1.ExternalTransportMode = TIS.Imaging.ExternalTransportModes.ET_MODE_FASTFORWARD; }

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.

[VB.NET]
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.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 MessageBox.Show("No device was selected.") Me.Close() 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
[C#]
private void Form1_Load(object sender, EventArgs e) { cmdETPlay.Enabled = false; cmdETStop.Enabled = false; cmdETFastForward.Enabled = false; cmdETRewind.Enabled = false; cmdStart.Enabled = false; cmdStop.Enabled = false; if (!icImagingControl1.DeviceValid) { icImagingControl1.ShowDeviceSettingsDialog(); if (!icImagingControl1.DeviceValid) { MessageBox.Show("No device was selected."); this.Close(); return; } } cmdStart.Enabled = true; cmdStop.Enabled = true; // Check whether external transport is available. if (icImagingControl1.ExternalTransportAvailable) { cmdETPlay.Enabled = true; cmdETStop.Enabled = true; cmdETFastForward.Enabled = true; cmdETRewind.Enabled = true; } }

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":

[VB.NET]
IcImagingControl1.LiveStart() IcImagingControl1.ExternalTransportMode = TIS.Imaging.ET_MODE_PLAY
[C#]
icImagingControl1.LiveStart(); icImagingControl1.ExternalTransportMode = TIS.Imaging.ET_MODE_PLAY;

<< Programmer's Guide

Get in touch with us


About The Imaging Source

Established in 1990, The Imaging Source is one of the leading manufacturers of industrial cameras, frame grabbers and video converters for production automation, quality assurance, logistics, medicine, science and security.

Our comprehensive range of cameras with USB 3.1, USB 3.0, USB 2.0, GigE interfaces and other innovative machine vision products are renowned for their high quality and ability to meet the performance requirements of demanding applications.

Automated Imaging Association ISO 9001:2015 certified

Contact us