This tutorial shows the most efficient way of creating a BITMAPHANDLE from a frame sample.
The following is an overview of the process:
ltmmConvert and ltmmCapture objects can pass you each sample using the IltmmMediaSampleDisp Interface. For simplicity, we will be using the ltmmConvert object from now on, but similar steps would be used with the ltmmCapture object.
You should create a ltmmMediaType object and set its:
Call IltmmSampleTarget::SetAcceptedMediaTypeto set the output sample type. You can also free the ltmmMediaType object since it is not needed anymore.
Specify that the output from ltmmConvert object will be the target sample grabber by calling IltmmConvert::put_TargetObject.
Make the convert object create its graph to know the size of the output samples. You can call IltmmConvert::put_SourceFile to tell it to start converting from an AVI file. Call IltmmConvert::StartConvert to force the filter to build the filter graph and update the output type.
Get the ltmmMediaType object which will be used by the sample grabber object by calling IltmmSampleTarget::GetConnectedMediaType. Get the dimensions of the samples by calling IltmmMediaTypeDisp::get_Format.
Use the width and height from the media type and create the shell LEADTOOLS bitmap by calling L_CreateBitmap and passing TYPE_USER for uMemory parameter. You can pass NULL for data if you do not have the data yet.
For each sample:
NOTE The shell bitmap should not be used after calling IltmmSampleTarget::Release. You should only call L_FreeBitmap or L_SetBitmapDataPointer beyond this point!.
For a C example, refer to Splitting an AVI File into a Multipage TIFF File Using ltmmSampleTarget for C.
For a C++ example, refer to Splitting an AVI File into a Multipage TIFF File Using ltmmSampleTarget for C++.
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries