Image Processing: Intelligent Rescale

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).

Intelligent Downscale

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.

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, 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.

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:

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.
image002
Image 4
Image 6

How does Intelligent Rescale identify and process the mask area?

  1. 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
    pBitmap pMaskBitmap
    Image 8
    Image 10

    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.

  2. Intelligent Rescale finds all edges within the original image (pBitmap), and stores those pixel values (8-bit) in an array.

  3. 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.

  4. 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.

  5. Intelligent Rescale passes the array to the designated function (Upscale or Downscale) for calculation.

See Also

Topics

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C++ Class Library Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.