LBitmap::Add

#include "ltwrappr.h"

virtual L_INT LBitmap::Add (pBitmapList, uFlags=BC_ADD)

LBitmapList * pBitmapList;

/* pointer to an LBitmapList object */

L_UINT uFlags;

/* operation flag */

Adds or averages the bitmaps in a list and the class object's bitmap. The class object's bitmap is updated with the resulting bitmap.

Parameter

Description

pBitmapList

Pointer to an LBitmapList object that contains a list of bitmaps.

uFlags

Flag that indicates the operation to perform. Possible values are:

 

Value

Meaning

 

BC_AVG

[0x0001] Average the bitmaps in the specified list.

 

BC_ADD

[0x0002] Add the bitmaps in the specified list.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This operation can be used to add several images of the same view to improve the lightness or brightness of the image. It can also eliminate the random noise contained in these images by doing an average of all bitmaps.

This function performs operations between data byte-by-byte. An image can be any color resolution.

Bitmap object is assumed to be empty. If Bitmap contains a bitmap, you should free it prior to calling this function. LBitmap::Add will allocate and store the resulting bitmap in Bitmap object. The image resulting from this operation is internally copied from the first image in the list, before performing the adding operation.

The operations are performed based on the smallest width and height of the input images.

To update a status bar or detect a user interrupt during execution of this function, refer to LBase::EnableStatusCallback.

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

This function does not support 32-bit grayscale images. It returns the error code ERROR_GRAY32_UNSUPPORTED if a 32-bit grayscale image is passed to this function.

The sign flag in the BITMAPHANDLE structure must be the same for all images listed. That is, all images must be either signed or unsigned.

Required DLLs and Libraries

LTDIS
LTFIL
LTIMGCLR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LBitmap::HighPassFilter, LBitmap::UnsharpMask, LBitmap::AdjustTint, LBitmap::GammaCorrectExt, LBitmap::BricksTexture, LBitmap::Canvas, LBitmap::DisplaceMap, LBitmap::Fragment, LBitmap::Vignette, LBitmap::AddWeighted

Topics:

Raster Image Functions: Combining Images

 

Raster Image Functions: Modifying Intensity Values

 

Processing an Image

 

Changing Brightness and Contrast

 

Removing Noise

 

Raster Image Functions: Removing Noise

 

Raster Image Functions: Changing Brightness and Contrast

Example

L_INT LBitmap__AddExample(LBitmap & Bitmap, L_TCHAR * szFile)
{
   L_INT nRet;
   LBitmapList BitmapList;
   LBitmap TempBitmap;
   nRet =Bitmap.Load(szFile);
   if(nRet !=SUCCESS)
      return nRet;
   nRet =BitmapList.Create();
   if(nRet !=SUCCESS)
      return nRet;
   for (L_INT i = 1; i < 4; i++)
   {
      nRet =TempBitmap.Copy(Bitmap);
      if(nRet !=SUCCESS)
         return nRet;
      nRet =TempBitmap.Rotate(7500 * i, ROTATE_RESAMPLE, RGB(255, 0, 0));
      if(nRet !=SUCCESS)
         return nRet;
      nRet =BitmapList.InsertItem(&TempBitmap);
      if(nRet !=SUCCESS)
         return nRet;
   }
   nRet =Bitmap.Add(&BitmapList, BC_AVG);
   if(nRet !=SUCCESS)
      return nRet;
   BitmapList.Destroy();
   
   return SUCCESS;
}