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 : Tuesday, April 18, 2017 9:03:09 AM(UTC)

Walter  
Walter

Groups: Tech Support, Administrators
Posts: 319

Was thanked: 3 time(s) in 3 post(s)

Each frame within a video stream can be accessed through the LEAD Video Callback filter. This is a video processing filter available with the Multimedia SDK. For more information on how to use a video processor, please check out How to apply audio/video effects using the Multimedia SDK?

It is possible to use multiple instances of this filter within the same graph if necessary. Each callback should process the data as quickly as possible before returning. Getting the different instances of the video callback filter to attach different callback implementations can be done by changing the integer provided in the GetSubObject() method. For example, if you added the video callback filter, the rotate filter, and another video callback filter, you would pass CaptureObject.SelVideoProcessor and CaptureObject.SelVideoProcessor + 2 respectively to get the two video callback filters.

Here is sample code illustrating how to add it and assign the user callback to be used. Here is the implementation of the callback method:
Code:

class LMVMyUserCallback : ILMVUserCallback
{
    public void ReceiveProc(int pData, int lWidth, int lHeight, int lBitCount, int lSize, int bTopDown)
    {
        RasterViewPerspective viewPerspective;
        if (bTopDown == 1)
            viewPerspective = RasterViewPerspective.TopLeft;
        else
            viewPerspective = RasterViewPerspective.BottomLeft;

        RasterImage img = new RasterImage(
            RasterMemoryFlags.User,
            lWidth,
            lHeight,
            lBitCount,
            RasterByteOrder.Bgr,
            viewPerspective,
            null,
            IntPtr.Zero,
            0);
        img.SetUserData(new IntPtr(pData), lSize);

        // TODO: Image Processing Here
    }
}


And where it is used:
Code:

int filterIndex = 0;
myCaptureCtrl.SelectedVideoProcessors.Add(myCaptureCtrl.VideoProcessors.Callback);
lmvCallback = (LMVCallback)myCaptureCtrl.GetSubObject(CaptureObject.SelVideoProcessor + filterIndex);
lmvMyUserCallback = new LMVMyUserCallback();
lmvCallback.ReceiveProcObj = lmvMyUserCallback;


There are shipping code examples in the SDK here:
• Examples\Multimedia\ltmm\Cpp\Callback
• Examples\Multimedia\ltmm\Cpp\CallbackOpenGLRender
• Examples\Multimedia\ltmm\Cpp\CallbackRender
• Examples\Multimedia\ltmm\Dotnet\CS\Callback
• Examples\Multimedia\ltmm\Dotnet\CS\CallbackRender
• Examples\Multimedia\ltmm\Dotnet\CS\DrawOnVideo
• Examples\Multimedia\ltmm\Dotnet\VB\Callback
• Examples\Multimedia\ltmm\Dotnet\VB\CallbackRender
• Examples\Multimedia\ltmm\Dotnet\VB\DrawOnVideo

There are also examples on the forums:

Edited by user Wednesday, April 19, 2017 2:44:25 PM(UTC)  | Reason: Not specified

Walter Bates
Senior 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.165 seconds.