Dev Center
Table of contents

.Net API Reference - BarcodeReader Video Methods

  • Decode

    Method Description
    StartFrameDecoding Starts a new thread to decode barcodes from the inner frame queue.
    StartFrameDecodingEx Starts a new thread to decode barcodes from the inner frame queue.
    AppendFrame Appends a frame image buffer to the inner frame queue.
    StopFrameDecoding Stops the frame decoding thread created by StartFrameDecoding.
  • Parameter

    Method Description
    InitFrameDecodingParameters Initializes frame decoding parameters.
  • Callback

    Method Description
    SetErrorCallback Set callback function to process errors which is triggered when the library finishes decoding a frame.
    SetTextResultCallback Set callback function to process text results which is triggered when the library finishes decoding a frame.
    SetIntermediateResultCallback Set callback function to process intermediate results which is triggered when the library finishes decoding a frame.
  • Status retrieval

    Method Description
    GetLengthOfFrameQueue Gets length of current inner frame queue.

StartFrameDecoding

Starts a new thread to decode barcodes from the inner frame queue.

EnumErrorCode Dynamsoft.Barcode.BarcodeReader.StartFrameDecoding(int maxQueueLength, int maxResultQueueLength, int width, int height, int stride, EnumImagePixelFormat imagePixelFormat, string templateName)

Parameters

[in] maxQueueLength <int> : The max count of frames waiting for decoding.
[in] maxResultQueueLength <int> : The max count of frames whose results (text result/localization result) will be kept for further reference.
[in] width <int> : The width of the frame image in pixels.
[in] height <int> : The height of the frame image in pixels.
[in] stride <int> : The stride of the frame image (also called scan width).
[in] imagPixelFormat <EnumImagePixelFormat> : The image pixel format used in the image byte array.
[in] templateName <string> : The template name.

Return value

Returns error code.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
EnumErrorCode error = reader.StartFrameDecoding(2, 10, 1024, 720, 720, EnumImagePixelFormat.IPF_BINARY, "");
reader.Dispose();

StartFrameDecodingEx

Starts a new thread to decode barcodes from the inner frame queue.

EnumErrorCode Dynamsoft.Barcode.BarcodeReader.StartFrameDecodingEx(ref FrameDecodingParameters parameters, string templateName) 

Parameters

[in] parameters <FrameDecodingParameters> : The frame decoding parameters.
[in] templateName <string> : The template name.

Return value

Returns error code.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
FrameDecodingParameters parameters = reader.InitFrameDecodingParameters();
parameters.MaxQueueLength = 3;
parameters.MaxResultQueueLength = 10;
parameters.Width = 20;
parameters.Height = 30;
parameters.Stride = 10;
parameters.ImagePixelFormat = EnumImagePixelFormat.IPF_GRAYSCALED;
parameters.Region.RegionMeasuredByPercentage = 1;
parameters.Region.RegionTop = 0;
parameters.Region.RegionBottom = 100;
parameters.Region.RegionLeft = 0;
parameters.Region.RegionRight = 100;
parameters.Threshold = 0.1;
parameters.FPS = 0;
EnumErrorCode error = reader.StartFrameDecodingEx(ref parameters, "");
reader.Dispose();

AppendFrame

Append a frame image buffer to the inner frame queue.

int Dynamsoft.Barcode.BarcodeReader.AppendFrame(IntPtr pBufferBytes)

Parameters

[in] pBufferBytes <IntPtr> : The array of bytes which contain the image data.

Return value

Returns the ID of the appended frame.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
int ret = reader.AppendFrame(pBufferBytes);
reader.Dispose();

StopFrameDecoding

Stop the frame decoding thread created by StartFrameDecoding or StartFrameDecodingEx.

EnumErrorCode Dynamsoft.Barcode.BarcodeReader.StopFrameDecoding()

Return value

Returns error code.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
EnumErrorCode err = reader.StopFrameDecoding();
reader.Dispose();

InitFrameDecodingParameters

Initialize frame decoding parameters with default values.

FrameDecodingParameters Dynamsoft.Barcode.BarcodeReader.InitFrameDecodingParameters()

Return value

Returns the frame decoding parameters.

SetErrorCallback

Sets call back function to process errors which is triggered when the library finishes decoding a frame.

EnumErrorCode Dynamsoft.Barcode.BarcodeReader.SetErrorCallback(CB_Error callbackFunction, IntPtr pUser)

Parameters

[in] callbackFunction <CB_Error> : Call back function.
[in] pUser <IntPtr> : Customized arguments passed to your function.

Return value

Returns error code.

Exceptions

BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
reader.SetErrorCallback(ErrorFunction, NULL);
EnumErrorCode error = reader.StartFrameDecoding(2, 10, 1024, 720, 720, IPF_BINARY, "");
reader.Dispose();

SetIntermediateResultCallback

Sets call back function to process intermediate results which is triggered when the library finishes decoding a frame.

EnumErrorCode Dynamsoft.Barcode.BarcodeReader.SetIntermediateResultCallback(CB_IntermediateResult callbackFunction, IntPtr pUser)

Parameters

[in] callbackFunction <CB_IntermediateResult> : Call back function.
[in] pUser <IntPtr> : Customized arguments passed to your function.

Return value

Returns error code.

Exceptions

BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
PublicRuntimeSettings settings = new PublicRuntimeSettings();
settings = reader.GetRuntimeSettings();
settings.IntermediateResultTypes = (int)(EnumIntermediateResultType.IRT_ORIGINAL_IMAGE | EnumIntermediateResultType.IRT_COLOUR_CLUSTERED_IMAGE | EnumIntermediateResultType.IRT_COLOUR_CONVERTED_GRAYSCALE_IMAGE);
reader.UpdateRuntimeSettings(settings);
reader.SetIntermediateResultCallback(IntermediateResultFunction, NULL);
EnumErrorCode error = reader.StartFrameDecoding(2, 10, 1024, 720, 720, IPF_BINARY, "");
reader.Dispose();

SetTextResultCallback

Sets call back function to process errors which is triggered when the library finishes decoding a frame.

EnumErrorCode Dynamsoft.Barcode.BarcodeReader.SetTextResultCallback(CB_TextResult callbackFunction, IntPtr pUser)

Parameters

[in] callbackFunction <CB_TextResult> : Call back function.
[in] pUser <IntPtr> : Customized arguments passed to your function.

Return value

Returns error code.

Exceptions

BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

BarcodeReader reader = new BarcodeReader();
reader.ProductKeys = "t0260NwAAAHV***************";
reader.SetTextResultCallback(TextResultFunction, NULL);
EnumErrorCode error = reader.StartFrameDecoding(2, 10, 1024, 720, 720, IPF_BINARY, "");
reader.Dispose();

GetLengthOfFrameQueue

Get current length of the inner frame queue.

int Dynamsoft.Barcode.BarcodeReader.GetLengthOfFrameQueue()	

Return value

Returns the length of the inner frame queue.

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

version 7.6.0

  • Latest version
  • Version 10.x
    • Version 10.2.0
    • Version 10.0.20
    • Version 10.0.10
    • Version 10.0.0
  • Version 9.x
    • Version 9.6.40
    • Version 9.6.30
    • Version 9.6.20
    • Version 9.6.10
    • Version 9.6.0
    • Version 9.4.0
    • Version 9.2.0
    • Version 9.0.0
  • Version 8.x
    • Version 8.8.0
    • Version 8.6.0
    • Version 8.4.0
    • Version 8.2.0
    • Version 8.1.2
    • Version 8.1.0
    • Version 8.0.0
  • Version 7.x
    • Version 7.6.0
    • Version 7.5.0
Change +