Gets a System.Drawing.Image object during a CaptureMode.Still capture.
public virtual Image GetStillImage(int timeOut)
Public Overridable Function GetStillImage( _ByVal timeOut As Integer _) As Image
public:virtual Image^ GetStillImage(int timeOut)
timeOut
Value containing the maximum time to wait for the image, in milliseconds.
Captured video image as a System.Drawing.Image
Gets a System.Drawing.Image object during a CaptureMode.Still capture. If TimeOut is -1, the method's time-out interval never elapses. If the method fails, an error is raised. For more information, refer to the Error Codes.
Note: The frame data is retrieved from the underlying graph after the processing filters. If the capture needs to occur before the processing is completed use the LeadVideoCallBackFilter and place it first in the collection of processing filters.
using Leadtools;using Leadtools.Multimedia;using LeadtoolsMultimediaExamples.Fixtures;public bool _result = false;public CaptureCtrlForm _form = new CaptureCtrlForm();public void GetStillImageExample(){// reference the capture controlCaptureCtrl capturectrl = _form.CaptureCtrl;// output filestring outFile = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_GetStillImageExample.jpg");try{// set the video capture device, use your capture device name hereif (capturectrl.VideoDevices["USB"] == null)throw new Exception("No USB video device available");capturectrl.VideoDevices["USB"].Selected = true;// set the capture mode to still and startcapturectrl.StartCapture(CaptureMode.Still);// get a still imageImage image = capturectrl.GetStillImage(-1);if (image != null)image.Save(outFile, ImageFormat.Jpeg);// stop the capturecapturectrl.StopCapture();// check for the capture file and set the resultif (File.Exists(Path.Combine(Directory.GetCurrentDirectory(), outFile)))_result = true;}catch (Exception){_result = false;}}static class LEAD_VARS{public const string MediaDir = @"C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media";}
Imports LeadtoolsImports Leadtools.MultimediaImports LeadtoolsMultimediaExamples.FixturesPublic _result As Boolean = FalsePublic _form As CaptureCtrlForm = New CaptureCtrlForm()Public Sub GetStillImageExample()' reference the capture controlDim capturectrl As CaptureCtrl = _form.CaptureCtrl' output fileDim outFile As String = Path.Combine(LEAD_VARS.MediaDir, "CaptureCtrl_GetStillImageExample.jpg")Try' set the video capture device, use your capture device name hereIf capturectrl.VideoDevices("USB") Is Nothing ThenThrow New Exception("No USB video device available")End Ifcapturectrl.VideoDevices("USB").Selected = True' set the capture mode to still and startcapturectrl.StartCapture(CaptureMode.Still)' get a still imageDim image As Image = capturectrl.GetStillImage(-1)If Not image Is Nothing Thenimage.Save(outFile, ImageFormat.Jpeg)End If' stop the capturecapturectrl.StopCapture()' check for the capture file and set the resultIf File.Exists(Path.Combine(Directory.GetCurrentDirectory(), outFile)) Then_result = TrueEnd IfCatch e1 As Exception_result = FalseEnd TryEnd SubPublic NotInheritable Class LEAD_VARSPublic Const MediaDir As String = "C:\Program Files (x86)\LEAD Technologies\LEADTOOLS 19\Media"End Class
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
