LEADTOOLS Multimedia (Leadtools.Multimedia assembly)
LEAD Technologies, Inc

CameraControl Property

Example 





Gets the camera control object exposed by the video input device.
Syntax
public virtual CameraControl CameraControl {get;}
'Declaration
 
Public Overridable ReadOnly Property CameraControl As CameraControl
'Usage
 
Dim instance As CaptureCtrl
Dim value As CameraControl
 
value = instance.CameraControl
public virtual CameraControl CameraControl {get;}
 get_CameraControl(); 
public:
virtual property CameraControl^ CameraControl {
   CameraControl^ get();
}

Property Value

A CameraControl object.
Remarks
The CameraControl interface is used to control device properties such as zoom, tilt, iris, etc.

Note: Not all devices expose this interface. Therefore, this property may be null for those devices without a camera control interface.

For more information, refer to the CameraControl object.

Example
Copy CodeCopy Code  
Public _result As Boolean = False
Public _form As CaptureCtrlForm = New CaptureCtrlForm()
Public Sub CameraControlExample()
  ' reference the capture control
  Dim capturectrl As CaptureCtrl = _form.CaptureCtrl

  Try
     ' try to find a USB video device, use your device name here
     If capturectrl.VideoDevices("USB") Is Nothing Then
       Throw New Exception("No USB video device available")
     End If

     capturectrl.VideoDevices("USB").Selected = True

     ' reference the camera control
     Dim camera As CameraControl = capturectrl.CameraControl

     If Not camera Is Nothing Then
       ' try to set some camera auto properties
       camera.AutoExposure = True
       camera.AutoFocus = True
       camera.AutoIris = True
       camera.AutoPan = False
       camera.AutoRoll = False
       camera.AutoTilt = False
       camera.AutoZoom = True

       ' now try to set some camera manual properties
       camera.Exposure = camera.ExposureInfo.Min
       camera.Focus = camera.FocusInfo.Max
       camera.Iris = camera.IrisInfo.Default
       camera.Pan = camera.PanInfo.Min
       camera.Roll = camera.RollInfo.Min
       camera.Tilt = camera.TiltInfo.Min
       camera.Zoom = camera.ZoomInfo.Min

       ' now increment a property by the stepping delta
       camera.Exposure += camera.ExposureInfo.StepDelta

       ' set the result to what we expect
       _result = (camera.Exposure = camera.ExposureInfo.Min + camera.ExposureInfo.StepDelta)

       ' now check a property to see if it is supported and has a manual setting
       ' if so, set it to auto
       If camera.ExposureInfo.Flags <> CameraControlFlags.Unsupported AndAlso camera.ExposureInfo.Flags = CameraControlFlags.Manual Then
         camera.AutoExposure = True
       End If

       ' set the result to what we expect
       _result = _result And (camera.ExposureInfo.Flags = CameraControlFlags.Auto)
     End If

     ' continue setting capture settings
     ' and possibly start a capture process
     ' ...
  Catch e1 As Exception
     _result = False
  End Try
End Sub
public bool _result = false;
public CaptureCtrlForm _form = new CaptureCtrlForm();
public void CameraControlExample()
{
   // reference the capture control
   CaptureCtrl capturectrl = _form.CaptureCtrl;

   try
   {
      // try to find a USB video device. use your device's name here
      if (capturectrl.VideoDevices["USB"] == null)
         throw new Exception("No USB video device available");

      capturectrl.VideoDevices["USB"].Selected = true;

      // reference the camera control
      CameraControl camera = capturectrl.CameraControl;

      if (camera != null)
      {
         // try to set some camera auto properties
         camera.AutoExposure = true;
         camera.AutoFocus = true;
         camera.AutoIris = true;
         camera.AutoPan = false;
         camera.AutoRoll = false;
         camera.AutoTilt = false;
         camera.AutoZoom = true;

         // now try to set some camera manual properties
         camera.Exposure = camera.ExposureInfo.Min;
         camera.Focus = camera.FocusInfo.Max;
         camera.Iris = camera.IrisInfo.Default;
         camera.Pan = camera.PanInfo.Min;
         camera.Roll = camera.RollInfo.Min;
         camera.Tilt = camera.TiltInfo.Min;
         camera.Zoom = camera.ZoomInfo.Min;

         // now increment a property by the stepping delta
         camera.Exposure += camera.ExposureInfo.StepDelta;

         // set the result to what we expect
         _result = (camera.Exposure == camera.ExposureInfo.Min + camera.ExposureInfo.StepDelta);

         // now check a property to see if it is supported and has a manual setting
         // if so, set it to auto
         if (camera.ExposureInfo.Flags != CameraControlFlags.Unsupported
            && camera.ExposureInfo.Flags == CameraControlFlags.Manual)
            camera.AutoExposure = true;

         // set the result to what we expect
         _result &= (camera.ExposureInfo.Flags == CameraControlFlags.Auto);
      }

      // continue setting capture settings
      // and possibly start a capture process
      // ...
   }
   catch (Exception)
   {
      _result = false;
   }
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

CaptureCtrl Class
CaptureCtrl Members

 

 


Products | Support | Contact Us | Copyright Notices

© 2006-2012 All Rights Reserved. LEAD Technologies, Inc.

Leadtools.Multimedia requires a Multimedia or Multimedia Suite license and unlock key. For more information, refer to: LEADTOOLS Toolkit Features