LEADTOOLS Intelligent Rescale reduces or increases image size with special attention to identifying and preserving the most important image features.
For example, in an interior shot, human beings may be very important, but large expances of blank wall are not. If such an image is resized using conventional algorythms, all areas of such an image will get equal treatment. While this preserves the relative proportions of all areas of the image, it also means that the important featuresthe peoplemay become too small to see, while the unimportant featurethe blank walldominates the scene.
Instead of cropping or resizing such images, you can use LEADTOOLS Intelligent Rescale to automatically detect and preserve the important image features. The Intelligent Rescale functions find connected chains of "unimportant" pixels from one image edge to its opposite edge, then eliminate (Downscale) or duplicate (Upscale) these pixel chains. The result is that important image elements (like people) are protected.
|Original Image||Conventional Resize Result||Intelligent Rescale Result|
In addition, you can "coach" the rescale process, by designating specific image areas as highly important (to be preserved), or unimportant (to be eliminated).
Based on parameters that you pass, LEADTOOLS Intelligent Downscale will calculate which horizontal or vertical chains of pixels contribute least to the important features of an image, define these as feature edges, and remove them first when resizing. This reduces image size without changing image colors, while preserving the "substance" of the image.
Two modes are possible: Regular and Fast.
Regular Downscale places priority on "importance" recognition for the specified dimension (width or height). It takes longer than Fast mode, but minimizes undesireable image artifacts (like unnatural edge lines) in the output file. It is the best choice for photographs and art images, where the importance of subject integrity is very high.
Fast Downscale places priority on processing speed. It delivers the fastest results for a specified dimension (width or height). It is the best option for batch processing of similar files, where minor imaging artifacts are relatively unimportant.
LEADTOOLS Intelligent Upscale calculates which horizontal or vertical chains of pixels contribute least to the important features of an image, and then inserts them twice in the new enlarged image. This has the effect of expanding the background space between major image features, without distorting the features themselves.
The user-designated insertion factor sets the number of passes (multiple steps) the Intelligent Upscale function will make. After each pass, it recalculates feature edges and importance.
For example, if the width Insertion factor is 2, the original image width is 400 pixels, and the user wants to enlarge the image width to 800 pixels, then Intelligent Upscale first calculates and inserts 200 pixel chains. It then recalulates importance paths, and inserts the final 200 pixel chains.
By making multiple passes, Intelligent Upscale "fine tunes" the image rescale, prventing undesireable image artifacts. This results in a "smoother" rescaled image.
Because Intelligent rescale must be able to identify uinique pixel chains to copy, a given image can only be upscaled to (2x-1) its original height and/or width. For example, if the original image is 400 pixels wide, it can be Upscaled to 799 pixels wide.
However, it is possible to rescale an image to the maximum, save it as a new image, and then rescale that result.
For even smarter rescale, you can designate areas to protect or remove during rescale. This allows you to maximize the space available in the image for important image features, while eliminating unimportant image areas.
For example, you may wish to protect human faces, document sections that must remain fully readable, or diagnostic portions of medical images, so that they will not be altered during rescale.
On the other hand, you may wish to designate specific individuals or objects, unread portions of documents, or undiagnostic areas of medical images as unimportant, to be eliminated during rescale.
The mask that you apply during coached rescale is not a literal marker for removal/preservation. Instead, it ranks the importance of the mask area in the overall image. In order to reduce undesirable image artifacts, the programmatic selection of pixel chains remains sensitive to important feature boundaries:
|Original Image||Remove Object Mask Applied||Resulting Image|
|Note that there are five people in the original image.||Mask applied to one person, and designated to be removed (removeObjectColor ) during Downscale.||Downscaled image. Only four people remain.|
During Intelligent Upscale or Intelligent Downscale, the developer passes two images with the same dimension. The original image is passed with the pBitmap parameter, and the mask image is passed as pMaskBitmap:
|Original Image||Mask Image|
In this example, the black area in the Mask Image is the mask area. Also pass the appropriate parameter to indicate whether it is to be preserved or removed during rescale. The mask does not have to be black, but must be a color that is not found in the original image.
Intelligent Rescale finds all edges within the original image (pBitmap), and stores those pixel values (8-bit) in an array.
Intelligent Rescale traverses all pixels in the array, and if a pixel location is the same as a pixel location in the mask area of the mask image, it sets the value of that pixel in the array to zero.
While traversing, Intelligent Rescale also determines the widest section of the mask area, in order to calculate the total number of pixel chains to be removed.
Intelligent Rescale passes the array to the designated function (Upscale or Downscale) for calculation.
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries