2.6.3.9 imgSubtractInterpBG(Pro)

Menu Information

Image: Arithmetic Transform: Subtract Interpolated Background

Brief Information

Subtract the background created with interpolation

Additional Information

It is not accessible from script. This feature is OriginPro only.

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Input Image

Specifies the input image to be manipulated. The default input is the active image.

Anchor Num

Specifies the number of the anchors on the image. The anchors will be used to create the interpolated background.

Background

Specifies whether or not the background is darker than the foreground.

Output Matrix

Specifies the output matrix. By default, a new image will be created and used as output.

Anchor Shape

Specifies the shape of the anchors (either ellipse or rectangle).

Apply Auto Level

This checkbox specifies whether or not to apply auto color leveling to the image after subtracting the interpolated background

Adjust Brightness

Specifies the increase/decrease of the brightness for the interpolated background. The value should be an integer between -10 and 10. A negative value will cause the brightness to be reduced while a positive value will result in brightness increase.

Description

When analyzing the contents of an image, the background typically does not contain anything of interest. In fact, in many cases the background can interfere with your analysis. One way to deal with this is to subtract it from the image. Subtracting the background from the image can help to segment out the objects of interest and facilitate further processing.

Often, we do not have a previously recorded background or an image of the background without any foreground objects. In this case, background subtract requires estimating the background with some algorithm and then subtracting it from the original image. Two tools provided by OriginPro are capable of performing this kind of background subtraction. They are Subtract Background and Subtract Interpolated Background. The major difference between them is the algorithm which is used to generate the background.

The ImgSubtractInterpBG X-Funtion, Subtract Interpolated Background tool in OriginPro subtracts the background that is created with interpolation. To create an interpolated background, the X, Y, and Z (Intensity) mean values within the anchor areas are computed. The background image is gridded from these XYZ values by the method of random matrix conversion based on the Thin Plain Spline (TPS) Algorithm. This tool also allows you to determine the anchor number, move and resize the anchors on the image to determine the interpolated background..

Note that this function only supports gray scale images.

Examples

The following example shows how to subtract an interpolated background from the input image:

  1. Create a new matrix and import Flower.jpg under \Samples\Image Processing and Analysis folder into it.
  2. From the menu, select Image: Conversion: Color to Gray, set 8 as Gray Scale and click OK to convert the image into 8-bit gray scale.
  3. From the menu, select Image: Arithmetic Transform: Subtract Interpolated Background to open the function in the X-Function panel beside the input image.
  4. Change the settings, move and resize the anchors on the image, as shown as below:
    BKSubMethod2Setting.png
    The interpolated background and the preview of the subtracted image will be shown in the new matrix book named imgSubtractIn:
    BKSubMethod2Input.png
    BKSubMethod2Ouput.png
    The original image
    Preview output after subtracted
  5. Click OK button, the output image will be outputted into a new matrix book called SubtractedBG.

Note: OriginPro includes the ability to automatically recalculate the analysis result of the background subtractoperation any time you change the parameters or update your source data. In addition, the settings for the analysis routine can be saved to an analysis theme for later use with similar data.

Algorithm

To create an interpolated background, the X, Y, and Z (Intensity) mean values within the anchor areas will be computed, then the background image is gridded from these XYZ values by the method of random matrix conversion base on Thin Plain spline (TPS) algorithm.

The computation of subtracting the interpolated background mainly uses L_CombineBitmapExt function from LEADTOOLS Main API. If Brighter than the Foreground is chosen as Background, the colors of the background will be inverted, and then the background and the input image will be combined with an adding operation. If Darker than the Foreground is chosen as Background, the background and the input image will be combined with a subtraction operation.

For more information on how the image is inverted and how the two images are combined please refer to the LEADTOOLS Main API Help file, Version 14 and read the L_InvertBitmap and L_CombineBitmapExt topics.

References

LEADTOOLS Main API Help file, Version 14

Related X-Functions

imgSubtractBg, imgReplaceBg, imgAutoLevel, imgBrightness