This interface provide functionalities of blob analysis. More...
Public Member Functions | |
void | AddBackgroundRange (int grayLB, int grayUB) |
void | AddBackgroundRangeColor (LColor colorLB, struct LColor colorUB) |
void | AddBlobFilter (ILBlobFilter *filter) |
void | AddBlobRange (int grayLB, int grayUB) |
void | AddBlobRangeColor (LColor colorLB, struct LColor colorUB) |
LPVErrorCode | Build (ILImage *img, ILRegion *region, ILBlobResults **results) |
int | CountBackgroundRange () |
int | CountBackgroundRangeColor () |
int | CountBlobFilter () |
int | CountBlobRange () |
int | CountBlobRangeColor () |
void | ItemBackgroundRange (int index, int *grayLB, int *grayUB) |
void | ItemBackgroundRangeColor (int index, LColor *colorLB, struct LColor *colorUB) |
ILBlobFilter * | ItemBlobFilter (int index) |
void | ItemBlobRange (int index, int *grayLB, int *grayUB) |
void | ItemBlobRangeColor (int index, LColor *colorLB, struct LColor *colorUB) |
void | Preview (ILImage *img, ILImage *outputImg) |
void | ResetBackgroundRange () |
void | ResetBackgroundRangeColor () |
void | ResetBlobFilter () |
void | ResetBlobRange () |
void | ResetBlobRangeColor () |
void | SelectRangeAuto (ILImage *image, int x, int y, double zoomX, double zoomY, double panX, double panY, int tolerance, int *grayLB, int *grayUB, ILImage *rangeMask) |
void | SelectRangeAutoColor (ILImage *image, int x, int y, double zoomX, double zoomY, double panX, double panY, int tolerance, LColor *colorLB, struct LColor *colorUB, ILImage *rangeMask) |
void | SetRangeThresholdAdaptGlobal (LPVPolarity blobPolarity) |
void | SetRangeThresholdAdaptLocal (LPVPolarity blobPolarity, int blockSize, int bias) |
void | SetSoftThresholdRange (int softRange) |
Public Member Functions inherited from ILObject | |
ILObject * | Copy () |
LPVErrorCode | Load (LString filename) |
void | Reset () |
LPVErrorCode | Save (LString filename) |
BOOL | Valid () |
Properties | |
LPVPolarity | AdaptBlobPolarity [get] |
The blob's polarity defined for the global or local adaptive thresholding in segmentation. More... | |
LPVImageFormat | ColorMode [get, set] |
The mode of the blob analysis tool, either handling grayscale or color image. | |
LPVBlobContourType | ContourType [get, set] |
The type of the result blob contours, see LPVBlobContourType. More... | |
BOOL | EnableMerge [get, set] |
Whether to enable blob merging. | |
LPVExcludeBoundaryMode | ExcludeBoundaryMode [get, set] |
The mode how to handle blobs that intersect the region boundary (exclude the entire blob, exclude only those outset pixels, or do nothing), see LPVExcludeBoundaryMode. | |
BOOL | FillHole [get, set] |
Whether to enable the contribution of holes in the overall blob statistics. By default, it's off. | |
int | Hierarchy [get, set] |
The hierarchy of the result blob contours. It's 0-based, negative value means all hierarchies. More... | |
int | LocalBias [get] |
The revised value to generate a local adaptive threshold. More... | |
int | LocalBlockSize [get] |
The size of the local region used in local adaptive thresholding. More... | |
int | MaxCount [get, set] |
The maximum of blobs to find. If there are more than the setting counts of blobs in the detect region, sort the candidates then pick the tops. More... | |
int | MergeAreaLB [get, set] |
The minimum acceptable area for the merged blobs. Area is the optional filtering property for the merged results and is not used to control the merging process. To constrain the size of the merged result, you should set the merge size bounds: MergeWidthLB, MergeWidthUB, MergeHeightLB, MergeHeightUB. | |
int | MergeAreaUB [get, set] |
The maximum acceptable area for the merged blobs. | |
int | MergeHeightLB [get, set] |
The minimum acceptable height (length of shorter axis) for the merged blobs. | |
int | MergeHeightUB [get, set] |
The maximum acceptable height (length of shorter axis) for the merged blobs. | |
LPVBlobMergeType | MergeType [get, set] |
The way to do the blob merging. | |
int | MergeWidthLB [get, set] |
The minimum acceptable width (length of longer axis) for the merged blobs. | |
int | MergeWidthUB [get, set] |
The maximum acceptable width (length of longer axis) for the merged blobs. | |
LPVBlobFeatures | SortBy [get, set] |
The method used to sort all blob candidates, the top ones are reported as final results. More... | |
BOOL | SortByDescending [get, set] |
Works together with SortBy. True to sort all blob candidates descending(from large value to small), false for sorting in ascending order. More... | |
LPVThresholdType | ThresholdType [get] |
The thresholding method used in segmentation. More... | |
This interface provide functionalities of blob analysis.
Blob analysis is a useful approach to segment object from background into connected components of similar grayscale values. Various geometric features, such as area, perimeter or circularity, can be computed on these blobs. In addition, image-related features, such as average luminance or contrast, can be computed based on the image attached.
To use this interface, you should create a LBlobAnalysis object.
void AddBackgroundRange | ( | int | grayLB, |
int | grayUB | ||
) |
Add grayscale value range for background. Pixels in this range will be treated as background.
It indicates this is a grayscale-mode blob analysis tool, all the previous color range setting will be cleaned up.
[in] | grayLB | The lower bound of the grayscale value range in 0 ~ 255. |
[in] | grayUB | The upper bound of the grayscale value range in 0 ~ 255. |
Add color value range for background. Pixels in this range will be treated as background.
It indicates this is a color-mode blob analysis tool, all the previous grayscale range setting will be cleaned up.
[in] | colorLB | The lower bound of the color value range. It's in the same channel order and color space as the source image. |
[in] | colorUB | The upper bound of the color value range. It's in the same channel order and color space as the source image. |
void AddBlobFilter | ( | ILBlobFilter * | filter | ) |
Add an alternative blob filter.
[in] | filter | The new blob filter |
void AddBlobRange | ( | int | grayLB, |
int | grayUB | ||
) |
Add grayscale value range for blob objects. Pixels in this range will be treated as foreground, and connected to be blobs.
It indicates this is a grayscale-mode blob analysis tool, all the previous color range setting will be cleaned up.
[in] | grayLB | The lower bound of the grayscale value range in 0 ~ 255. |
[in] | grayUB | The upper bound of the grayscale value range in 0 ~ 255. |
Add color value range for blob objects. Pixels in this range will be treated as foreground, and connected to be blobs.
It indicates this is a color-mode blob analysis tool, all the previous grayscale range setting will be cleaned up.
[in] | colorLB | The lower bound of the color value range. It's in the same channel order and color space as the source image. |
[in] | colorUB | The upper bound of the color value range. It's in the same channel order and color space as the source image. |
LPVErrorCode Build | ( | ILImage * | img, |
ILRegion * | region, | ||
ILBlobResults ** | results | ||
) |
Build the blobs using the input image and the provided region.
[in] | img | The input image. You should pass in the images of the matching format, aka. grayscale images for grayscale blob analysis mode. Otherwise, we will do the conversion automatically according to the current blob analysis mode. |
[in] | region | The input region. |
[out] | results | Return the blob results. |
error | Return error code if anything is wrong. |
int CountBackgroundRange | ( | ) |
Get count of the grayscale value ranges for background.
int CountBackgroundRangeColor | ( | ) |
Get count of the color value ranges for background.
int CountBlobFilter | ( | ) |
Get count of the blob filters.
int CountBlobRange | ( | ) |
Get count of the grayscale value ranges for blob objects.
int CountBlobRangeColor | ( | ) |
Get count of the color value ranges for blob objects.
void ItemBackgroundRange | ( | int | index, |
int * | grayLB, | ||
int * | grayUB | ||
) |
Get the grayscale value ranges for background, with the given index.
[in] | index | The input index, it should be a 0-based number smaller than total count. |
[out] | grayLB | Return the lower bound of the grayscale value range. |
[out] | grayUB | Return the upper bound of the grayscale value range. |
Get the color value ranges for background, with the given index.
[in] | index | The input index, it should be a 0-based number smaller than total count. |
[out] | colorLB | Return the lower bound of the color value range. |
[out] | colorUB | Return the upper bound of the color value range. |
ILBlobFilter* ItemBlobFilter | ( | int | index | ) |
Reset the blob filters, all settings are cleaned up.
void ItemBlobRange | ( | int | index, |
int * | grayLB, | ||
int * | grayUB | ||
) |
Get the grayscale value ranges for blob objects, with the given index.
[in] | index | The input index, it should be a 0-based number smaller than total count. |
[out] | grayLB | Return the lower bound of the grayscale value range. |
[out] | grayUB | Return the upper bound of the grayscale value range. |
Get the color value ranges for blob objects, with the given index.
[in] | index | The input index, it should be a 0-based number smaller than total count. |
[out] | colorLB | Return the lower bound of the color value range. |
[out] | colorUB | Return the upper bound of the color value range. |
Preview the binarized image the input image with current foreground and background range configuration.
[in] | img | The input image. You should pass in the images of the matching format, aka. grayscale images for grayscale blob analysis mode. Otherwise, we will do the conversion automatically according to the current blob analysis mode. |
[out] | outputImg | Return the preview image. |
void ResetBackgroundRange | ( | ) |
Reset the grayscale value ranges for background, all settings are cleaned up.
void ResetBackgroundRangeColor | ( | ) |
Reset the color value ranges for background, all settings are cleaned up.
void ResetBlobFilter | ( | ) |
Remove all blob filters.
void ResetBlobRange | ( | ) |
Reset the grayscale value ranges for blob objects, all settings are cleaned up.
void ResetBlobRangeColor | ( | ) |
Reset the color value ranges for blob objects, all settings are cleaned up.
void SelectRangeAuto | ( | ILImage * | image, |
int | x, | ||
int | y, | ||
double | zoomX, | ||
double | zoomY, | ||
double | panX, | ||
double | panY, | ||
int | tolerance, | ||
int * | grayLB, | ||
int * | grayUB, | ||
ILImage * | rangeMask | ||
) |
Select a grayscale value range on the provided image. You should then explicitly add the range as blob or background range. It's usually called for a grayscale-mode blob analysis tool.
[in] | image | The input image. |
[in] | x | The x-coordinate of the cursor(selected) position. |
[in] | y | The y-coordinate of the cursor(selected) position. |
[in] | tolerance | The maximum relative difference of neighbor pixels that build the selection |
[out] | grayLB | Return the lower bound of the grayscale value range in 0 ~ 255. |
[out] | grayUB | Return the upper bound of the grayscale value range in 0 ~ 255. |
[out] | rangeMask | Return the mask image of the same size as the input image, white pixels represent the ones in selected grayscale value range in 0 ~ 255. Optional, could be null. |
void SelectRangeAutoColor | ( | ILImage * | image, |
int | x, | ||
int | y, | ||
double | zoomX, | ||
double | zoomY, | ||
double | panX, | ||
double | panY, | ||
int | tolerance, | ||
LColor * | colorLB, | ||
struct LColor * | colorUB, | ||
ILImage * | rangeMask | ||
) |
Select a color value range on the provided image. You should then explicitly add the range as blob or background range.
[in] | image | The input image. |
[in] | x | The x-coordinate of the cursor(selected) position. |
[in] | y | The y-coordinate of the cursor(selected) position. |
[in] | tolerance | The maximum relative difference of neighbor pixels that build the selection |
[out] | colorLB | Return the lower bound of the color value range. It's in the same channel order and color space as the source image. |
[out] | colorUB | Return the upper bound of the color value range. It's in the same channel order and color space as the source image. |
[out] | rangeMask | Return the mask image of the same size as the input image, white pixels represent the ones in selected grayscale value range in 0 ~ 255. Optional, could be null. |
void SetRangeThresholdAdaptGlobal | ( | LPVPolarity | blobPolarity | ) |
Use global-adaptive thresholding for segmentation. The optimal threshold value is calculated base on the entire input image.
[in] | blobPolarity | The object polarity of the blob. LPVBlackOnWhite indicates black pixels with smaller value than global threshold are the blobs, LPVWhiteOnBlack is exactly the opposite. |
void SetRangeThresholdAdaptLocal | ( | LPVPolarity | blobPolarity, |
int | blockSize, | ||
int | bias | ||
) |
Use local-adaptive threshold value. The optimal threshold value is calculated base on a \( blockSize \times blockSize \) region around individual pixel, then revised by the given bias value.
[in] | blobPolarity | The object polarity of the blob. LPVBlackOnWhite indicates black pixels with smaller value than global threshold are the blobs, LPVWhiteOnBlack is exactly the opposite. |
[in] | blockSize | Size of a pixel's local region, should be an odd number, say, 3, 5, 7, etc. Set it to 0 for auto-generate block size based in the input image size. |
[in] | bias | Revise value to optimal threshold value as \( t' = t - bias \) for LPVBlackOnWhite , \( t' = t + bias \) for LPVWhiteOnBlack . |
void SetSoftThresholdRange | ( | int | softRange | ) |
Set the weighted range of soft thresholding. By default, it's 0 which means soft thresholding is not enabled.
It is useful to locate blobs more robust and more accurately.
For example, if we define blob color range to be [100, 200], and soft thresholding range to be 5, then, [0, 95] and [205, 255] are background, [105, 195] are foreground, [96, 104] are weighted as 0.1 ~ 0.9 to be foreground, [196, 204] are weighted as 0.9 ~ 0.1 to be foreground. Soft thresholding results in soft mask of the result blobs, and will affect the calculation of blob's geometric features, such as area or center. Pixels inside the blob contribute to the final result according to its weight.
[in] | softRange | The soft thresholding range, create a [t - softRange, t + softRange] range. |
|
get |
The blob's polarity defined for the global or local adaptive thresholding in segmentation.
|
getset |
The type of the result blob contours, see LPVBlobContourType.
|
getset |
The hierarchy of the result blob contours. It's 0-based, negative value means all hierarchies.
|
get |
The revised value to generate a local adaptive threshold.
|
get |
The size of the local region used in local adaptive thresholding.
|
getset |
The maximum of blobs to find. If there are more than the setting counts of blobs in the detect region, sort the candidates then pick the tops.
|
getset |
The method used to sort all blob candidates, the top ones are reported as final results.
|
getset |
|
get |
The thresholding method used in segmentation.