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. |
SetUniqueBarcodeCallback |
Set callback function to process text results which is triggered when the library finishes decoding a frame and finds unique barcodes. |
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 = BarcodeReader.GetInstance();
if (reader != null)
{
EnumErrorCode error = reader.StartFrameDecoding(2, 10, 1024, 720, 720, EnumImagePixelFormat.IPF_BINARY, "");
//... add further process
reader.Recycle();
}
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 = BarcodeReader.GetInstance();
if (reader != null)
{
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, "");
//... add further process
reader.Recycle();
}
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 = BarcodeReader.GetInstance();
if (reader != null)
{
int ret = reader.AppendFrame(pBufferBytes);
//... add further process
reader.Recycle();
}
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 = BarcodeReader.GetInstance();
if (reader != null)
{
//... add further process
EnumErrorCode err = reader.StopFrameDecoding();
//... add further process
reader.Recycle();
}
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 = BarcodeReader.GetInstance();
if (reader != null)
{
reader.SetErrorCallback(ErrorFunction, NULL);
EnumErrorCode error = reader.StartFrameDecoding(2, 10, 1024, 720, 720, IPF_BINARY, "");
//... add further process
reader.Recycle();
}
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 = BarcodeReader.GetInstance();
if (reader != null)
{
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, "");
//... add further process
reader.Recycle();
}
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 = BarcodeReader.GetInstance();
if (reader != null)
{
reader.SetTextResultCallback(TextResultFunction, NULL);
EnumErrorCode error = reader.StartFrameDecoding(2, 10, 1024, 720, 720, IPF_BINARY, "");
//... add further process
reader.Recycle();
}
SetUniqueBarcodeCallback
Set callback function to process text results which is triggered when the library finishes decoding a frame and finds unique barcodes.
EnumErrorCode Dynamsoft.DBR.BarcodeReader.SetUniqueBarcodeCallback(CB_TextResult callbackFunction, IntPtr pUser)
Parameters
[in] callbackFunction
<CB_TextResult> : Call back function.
[in] pUser
Customized arguments passed to your function.
Return Value
Returns EnumErrorCode.DBR_SUCCESS if the function operates successfully.
Exception
BarcodeReaderException
The exception thrown by Dynamsoft Barcode Reader.
Code Snippet
string errorMsg;
BarcodeReader.InitLicense("YOUR-LICENSE-KEY", out errorMsg);
BarcodeReader reader = BarcodeReader.GetInstance();
if (reader != null)
{
reader.SetUniqueBarcodeCallback(TextResultFunction, NULL);
EnumErrorCode error = reader.StartFrameDecoding(2, 10, 1024, 720, 720, IPF_BINARY, "");
//... add further process
reader.Recycle();
}
GetLengthOfFrameQueue
Get current length of the inner frame queue.
int Dynamsoft.DBR.BarcodeReader.GetLengthOfFrameQueue()
Return Value
Returns the length of the inner frame queue.