LEADTOOLS Support
Multimedia
Multimedia SDK Examples
HOW TO: Use the LEADTOOLS Video Callback Filter to recognize barcodes via webcam.
#1
Posted
:
Friday, April 28, 2017 2:03:36 PM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 39
Thanks: 2 times
Was thanked: 3 time(s) in 3 post(s)
Attached is a very simple example that demonstrates how the LEADTOOLS can be used to process individual video frames and extract barcode information. This uses both the
LEADTOOLS Multimedia SDK and the
LEADTOOLS Barcode SDK. Using the
LEADTOOLS Video Callback Filter.
I used the LEADTOOLS CaptureCtrl in this project and I created a custom class the implements the
ILMVUserCallback interface, which has one method:
Code:public void ReceiveProc(int pData, int lWidth, int lHeight, int lBitCount, int lSize, int bTopDown)
This method is called for every frame received by the Callback filter. Here we can access the data for each frame of a media file or live capture and with that create a LEADTOOLS RasterImage for further processing:
Code:img = new RasterImage(
RasterMemoryFlags.Conventional, //A combination of the RasterMemoryFlags enumeration members indicating the type of memory to allocate for the image data.
lWidth, // Width of the image in pixels.
lHeight, //Height of the image in pixels.
lBitCount, //The number of bits per pixel.
RasterByteOrder.Bgr, //Color order for 16-, 24-, 32-, 48- and 64-bit images.
viewPerspective, //Specifies where the beginning of the image is stored.
null, //The palette that the image will use. You can specify your own palette, or use null (Nothing in Visual Basic) for LEAD's fixed palette. The palette member is used only when bitsPerPixel is less than or equal to 8.
null, //Unmanaged data pointer that will contain the image data when flags is RasterMemoryFlags.User.
lSize); //Length in bytes of the data passed to userData. Only when used when userData is not IntPtr.Zero and flags is RasterMemoryFlags.User.
img.Access();
img.SetRow(0, new IntPtr(pData), lSize);
img.Release();
//at this point you have an image of the current frame in memory and you can apply processing, some form of recognition, etc..
The project runs a very simple barcode recognition routine:
Code:BarcodeData[] DetectedBarcodecs = barcodeEngine.Reader.ReadBarcodes(image, LogicalRectangle.Empty, 0, new BarcodeSymbology[] { BarcodeSymbology.Unknown });
if (DetectedBarcodecs != null)
{
foreach (BarcodeData data in DetectedBarcodecs)
{
if (data != null)
{
Console.WriteLine("Barcode Sybmology: " + data.Symbology);
}
}
}
The attached project is a .NET C# created with Visual Studio 2017. This project assumes you have both the LEADTOOLS Multimedia SDK and the LEADTOOLS SDK installed in the default locations as seperate installations. The reference paths in this project are set to:
C:\LEADTOOLS 19\Bin\Dotnet4\Win32\
and
C:\LEADTOOLS Multimedia 19\Bin\Dotnet4\Win32\
If your setup is different do change these accordingly.
You should be able to download this zip file, extract it, and run it from Visual Studio.
Edited by moderator Thursday, April 18, 2019 7:56:21 AM(UTC)
| Reason: Not specified
Roberto Rodriguez
Developer Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
#2
Posted
:
Tuesday, December 17, 2019 9:35:55 AM(UTC)
Groups: Registered, Tech Support, Administrators
Posts: 15
Was thanked: 1 time(s) in 1 post(s)
This has been updated for version 20 of the LEADTOOLS SDK.
Please extract this project to the below default installation path:
C:\LEADTOOLS 20\Examples\DotNet\CS\
The reference paths in this project are set to the below if you have integrated the Multimedia Evaluation with your Main LEADTOOLS Evaluation SDK:
C:\LEADTOOLS 20\Bin\Dotnet4\x64\
Blaise Kress
Developer Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
#3
Posted
:
Friday, July 30, 2021 12:15:22 PM(UTC)
Groups: Registered, Manager, Tech Support, Administrators
Posts: 107
Was thanked: 9 time(s) in 9 post(s)
This project has been updated to support v21. This can be downloaded here:
Marcus Andra
Developer Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
LEADTOOLS Support
Multimedia
Multimedia SDK Examples
HOW TO: Use the LEADTOOLS Video Callback Filter to recognize barcodes via webcam.
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.