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 8:58:09 AM(UTC)

Walter  
Walter

Groups: Tech Support
Posts: 366

Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)

An updated example which shows how to apply a Multimedia Filter can be found here: https://www.leadtools.co...ter-to-a-video-file.html

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\DirectShow\CPP\Callback
• Examples\Multimedia\DirectShow\CPP\CallbackOpenGLRender
• Examples\Multimedia\DirectShow\CPP\CallbackRender
• Examples\Multimedia\DirectShow\CPP\Callback
• Examples\Multimedia\DirectShow\CPP\CallbackRender
• Examples\Multimedia\DirectShow\CPP\DrawOnVideo

There are also examples on the forums:
[indent]• How To: Use Video Callback filter to create fading effects
HOW TO: Grab and Process Frames using LTMM
HOW TO: Ocr Video using the callback filter
Overlaying Animated Logo onto video
HOW TO: Capture to MPEG2 with Video Callback Filter for Stills

Edited by moderator Wednesday, December 27, 2023 4:57:57 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-2024, Yet Another Forum.NET
This page was generated in 0.046 seconds.