Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Friday, April 28, 2017 2:08:36 PM(UTC)

Roberto  
Roberto

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 ConvertCtrl 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.
File Attachment(s):
DotNet_Callback.zip (33kb) downloaded 196 time(s).
Roberto Rodriguez
Developer Support Engineer
LEAD Technologies, Inc.

LEAD Logo
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

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.

Powered by YAF.NET | YAF.NET © 2003-2017, Yet Another Forum.NET
This page was generated in 0.134 seconds.