virtual L_INT LBitmap::Add (pBitmapList, uFlags=BC_ADD)
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.
Pointer to an LBitmapList object that contains a list of bitmaps.
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. |
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
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.
Win32, x64.
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;
}
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