L_StitchBitmap

#include "l_bitmap.h"

L_LTIMGEFX_API L_INT L_StitchBitmap(pRefBitmap, pToStitchBitmaps, uNumToStichBitmaps, pStitchSettings)

Stitches together a designated number of bitmaps given a Reference bitmap.

Parameters

pBITMAPHANDLE pRefBitmap

The pointer to the Reference Bitmap.

pBITMAPHANDLE *pToStitchBitmaps

A pointer to a list of bitmaps that will be stitched together.

L_UINT uNumToStichBitmaps

The number of bitmaps in pToStitchBitmaps.

pSTITCH_SETTINGS pStitchSettings

Specifies the stitching settings for the function.

Returns

Value Meaning
SUCCESS The function was successful.
< 1 An error occurred. Refer to Return Codes.

Required DLLs and Libraries

Platforms

Win32, x64, Linux.

See Also

Example

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 Version 22.0.2021.9.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.