Increases the size of the image while preserves important features automatically. Also, it can preserve certain objects that chosen by the user without affecting the natural look of the image. This feature is available in version 16 or higher.
#include "ltwrappr.h"
L_INT LBitmap::IntelligentUpScale(pMaskBitmap, crRemoveObjectColor, crPreserveObjectColor, nNewWidth, nWidthUpScalingFactor, nNewHeight, nHeightUpScalingFactor, nUpScalingOrder, uFlags = 0)
L_INT LBitmap::IntelligentUpScale(phMaskBitmap, crRemoveObjectColor, crPreserveObjectColor, nNewWidth, nWidthUpScalingFactor, nNewHeight, nHeightUpScalingFactor, nUpScalingOrder, uFlags = 0)
Pointer to LBitmapBase class object; that references the mask bitmap. Mask bitmap is the same as the class object's bitmap but with a color mask on certain areas that need to be preserved during the upscaling operation. Pass NULL if there is no mask bitmap. You will need to pass a bitmap with the same size of the class object's bitmap; otherwise, the function will return ERROR_INV_PARAMETER.
Pointer to the mask bitmap handle that references the mask bitmap. Mask bitmap is the same as the class object's bitmap but with a color mask on certain areas that need to be preserved during the upscaling operation. Pass NULL if there is no mask bitmap. You will need to pass a bitmap with the same size of the class object's bitmap; otherwise, the function will return ERROR_INV_PARAMETER.
COLORREF value that specifies the color of the area in the mask bitmap to be removed. It is preferred to be different than color in the image. Pass INTELLIGENTRESCALE_NOREMOVECOLOR if you don't want to pass any color value.
COLORREF value that specifies the color of the area in the mask bitmap to be preserved. It is preferred to be different than the color specified in crRemoveObjectColor and original color used in the class object's bitmap. Pass INTELLIGENTRESCALE_NOREMOVECOLOR if you don't want to pass any color value.
New width in pixels. Possible values are range from (width of the image +1) to (2* width of the image) -1.
Width up scaling process is divided to stages until new width is achieved. This is used to get better results in some cases. Possible values are:
If mask bitmap is used:
INTELLIGENTRESCALE_NOUPSCALINGFACTOR
Otherwise:
1
.
.
INTELLIGENTRESCALE_DEFAULTUPSCALINGFACTOR
.
.
20
New height in pixel. Possible values are range from (height of the image +1) to (2* height of the image) -1.
Height up scaling process is divided to stages until new height is achieved. This is used to get better results in some cases. Possible values are: INTELLIGENTRESCALE_NOUPSCALINGFACTOR, INTELLIGENTRESCALE_DEFAULTUPSCALINGFACTOR, recommended range from 1 to 20.
If mask is used, then INTELLIGENTRESCALE_NOUPSCALINGFACTOR macro should be passed.
Upscaling behavior. Possible values are:
Value | Meaning |
---|---|
INTELLIGENTRESCALE_VERTHORZ | Upscale the image width first, then the height. |
INTELLIGENTRESCALE_HORZVERT | Upscale the image height first, then the width. |
Reserved for future. Must be zero.
Value | Meaning |
---|---|
SUCCESS | The function was successful. |
< 1 | An error occurred. Refer to Return Codes. |
Intelligent upscaling rescales the areas deemed unimportant in the image.
Upscaling using a mask is done only on the width dimension. To upscale using a mask on the height dimension, rotate the image, upscale on the width dimension, and then rotate again.
There are no upscaling steps when a mask is used. During upscale, a masked "remove area" indicates that an area is not important. Therefore, the upscale effect is concentrated in this area.
The color of the remove area must be different than colors in the class object's bitmap.
The color of the preserve area must be different than the colors in the class object's bitmap and different from the remove area color.
If multiple remove objects are exist, then all must be the same remove color area. Same thing applies to preserve color area.
It is usually most effective to draw the mask over the remove area from top to bottom of the image, passing through the remove area. Make the mask wide enough to force the up scaling to concentrate more only in the remove area.
This function does not support 12 and 16-bit grayscale and 48 and 64-bit color images. If the image is 12 and 16-bit grayscale and 48 and 64-bit color, the function will not return an error.
This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.
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.
Intelligent Up Scale Function - Before
Intelligent Up Scale Function - After
View additional platform support for this Intelligent Up Scale function.
Win32, x64.
L_INT LBitmap__IntelligentUpScaleExample()
{
L_INT nRet;
LBitmap LeadBitmap;
nRet =LeadBitmap.Load(MAKE_IMAGE_PATH(TEXT("SAMPLE3.CMP")), 0,ORDER_BGR);
if(nRet !=SUCCESS)
return nRet;
nRet =LeadBitmap.IntelligentUpScale((pBITMAPHANDLE)NULL, (COLORREF)INTELLIGENTRESCALE_NOREMOVECOLOR, (COLORREF)INTELLIGENTRESCALE_NOPRESERVECOLOR, 900, 4, 450, 4,INTELLIGENTRESCALE_VERTHORZ, 0);
if(nRet !=SUCCESS)
return nRet;
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