Dev Center
Table of contents

Video Methods

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.
InitFrameDecodingParameters Initializes frame decoding parameters.
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.
GetLengthOfFrameQueue Gets length of current inner frame queue.

StartFrameDecoding

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

EnumErrorCode Dynamsoft.DBR.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

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = new BarcodeReader();
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.DBR.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

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = new BarcodeReader();
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.DBR.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

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = new BarcodeReader();
int ret = reader.AppendFrame(pBufferBytes);
reader.Dispose();

StopFrameDecoding

Stop the frame decoding thread created by StartFrameDecoding or StartFrameDecodingEx.

EnumErrorCode Dynamsoft.DBR.BarcodeReader.StopFrameDecoding()

Return Value
Returns error code.

Code Snippet

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = new BarcodeReader();
EnumErrorCode err = reader.StopFrameDecoding();
reader.Dispose();

InitFrameDecodingParameters

Initialize frame decoding parameters with default values.

FrameDecodingParameters Dynamsoft.DBR.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.DBR.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.

Exception
BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = new BarcodeReader();
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.DBR.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.

Exception
BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = new BarcodeReader();
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.DBR.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.

Exception
BarcodeReaderException The exception thrown by Dynamsoft Barcode Reader.

Code Snippet

string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = new BarcodeReader();
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.DBR.BarcodeReader.GetLengthOfFrameQueue()	

Return Value
Returns the length of the inner frame queue.

This page is compatible for:

Is this page helpful?

YesYes NoNo

In this article:

version 9.4.0

  • Latest version
  • Version 10.x
    • Version 10.4.10
    • Version 10.2.10
    • 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
  • Documentation Homepage
Change +