Stitches together a designated number of bitmaps given a Reference bitmap.
#include "l_bitmap.h"
L_LTIMGEFX_API L_INT L_StitchBitmap(pRefBitmap, pToStitchBitmaps, uNumToStichBitmaps, pStitchSettings)
The pointer to the Reference Bitmap.
A pointer to a list of bitmaps that will be stitched together.
The number of bitmaps in pToStitchBitmaps.
Specifies the stitching settings for the function.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Stitch Function - Before
Stitch Function - After
View additional platform support for this Stitch function.
Win32, x64, Linux.
L_StitchBitmap does not support merging images with different scales, orientations, and rotations.
However, stitching results on images that are at the same scale, orientation, and rotation, can be optimized with pStitchSettings
.
This example stitches together a series of given bitmaps
L_INT StitchBitmapExample()
{
STITCH_SETTINGS StitchSettings = { 0 };
pBITMAPHANDLE* pToStitchBitmaps = NULL;
BITMAPHANDLE ReferenceBitmap = { 0 };
L_INT nStitchBitmaps;
L_INT i, nRet;
// Load Reference Bitmap, keeping the original bits per pixel of the image
nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("Reference.bmp")), &ReferenceBitmap, sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if (nRet != SUCCESS)
return nRet;
// Specify number of bitmaps to stitch
nStitchBitmaps = 3;
// Allocate space for the list of pointers to bitmaps
pToStitchBitmaps = (pBITMAPHANDLE*)calloc(nStitchBitmaps, sizeof(pBITMAPHANDLE));
if (pToStitchBitmaps == NULL)
return -1; // Return if not enough memory
for (i = 0; i < nStitchBitmaps; i++)
{
// Allocate space for each bitmap we need to stitch
pToStitchBitmaps[i] = (pBITMAPHANDLE)calloc(1, sizeof(BITMAPHANDLE));
if (pToStitchBitmaps[i] == NULL)
return -1;
}
// Load sequence of images to stitch to the reference bitmap
nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("Frame1.bmp")), pToStitchBitmaps[0], sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if (nRet != SUCCESS)
return nRet;
nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("Frame2.bmp")), pToStitchBitmaps[1], sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if (nRet != SUCCESS)
return nRet;
nRet = L_LoadBitmap(MAKE_IMAGE_PATH(TEXT("Frame3.bmp")), pToStitchBitmaps[2], sizeof(BITMAPHANDLE), 0, ORDER_BGR, NULL, NULL);
if (nRet != SUCCESS)
return nRet;
// Specify the Stitch Settings
StitchSettings.uStructSize = sizeof(STITCH_SETTINGS);
StitchSettings.ImageType = STITCH_IMAGE_TYPE_PICTURE;
StitchSettings.StitchMethod = STITCH_METHOD_TYPE_EXHAUSTIVE;
StitchSettings.SideMatchingMethod = STITCH_SIDE_MATCHING_TYPE_KEEPLEFT; // Stitches the left side of the Frames to the Reference
// Call Stitch Bitmap function
nRet = L_StitchBitmap(&ReferenceBitmap, pToStitchBitmaps, nStitchBitmaps, &StitchSettings);
if (nRet != SUCCESS)
return nRet;
// Save bitmap
nRet = L_SaveBitmap(TEXT("./StitchedBitmap.bmp"), &ReferenceBitmap, FILE_BMP, 24, 0, NULL);
// Free memory
for (i = 0; i < nStitchBitmaps; i++)
{
L_FreeBitmap(pToStitchBitmaps[i]);
}
free(pToStitchBitmaps);
return nRet;
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document