LEADTOOLS Raster Imaging C DLL Help > Getting Started > Basic Concepts > Introduction: Intelligent Rescale |
LEADTOOLS Intelligent Rescale reduces or increases image size with special attention to identify and preserve the most important image features.
For example, in an interior shot, human beings may be very important, but large expanses of blank wall are not. If such an image is resized using a conventional algorithm, 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 features the people may become too small to see, while the unimportant feature the blank wall dominates 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 are protected.
Click here to see sample results from applying intelligent rescale on an image.
In addition, you can "coach" the rescale process, by designating specific image areas as highly important (to be preserved), or unimportant (to be eliminated).
Intelligent Downscale
Based on parameters that you pass to L_IntelligentDownScaleBitmap, 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 undesirable 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.
Intelligent Upscale
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, using the L_IntelligentUpScaleBitmap function, 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 re-calculates importance paths, and inserts the final 200 pixel chains.
By making multiple passes, intelligent upscale "fine tunes" the image rescale, preventing undesirable image artifacts. This results in a "smoother" rescaled image.
Because intelligent rescale must be able to identify unique 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.
Coached Rescale (Intelligent Rescale with Applied Mask)
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:
Click here to see sample results from applying coached rescale on an image.
For more information, refer to:
Using the Intelligent Rescale Demo