REGION_COUNT Function (PV-WAVE Extreme Advantage)

Computes the number of regions in an image.

Usage

result = REGION_COUNT(image)

Input Parameters

image—A 2D array containing binary regions. Each binary region must be filled with a different value.

 

Note

If image does not contain binary regions, the Search_Values keyword must be specified.

Returned Value

result—The number of separate regions in image.

Keywords

Search_Values—A scalar value greater than zero, or an array containing values greater than zero to search for in image. These values are then used as seed points for growing regions. The number of regions grown are then counted.

Seeds—A 1D long array of n_region  points specifying a variable to receive the element-number of a point in each region.

Discussion

When the Search_Values or Seeds keywords are defined, regions in the array are grown based on the amplitude values specified with the Search_Values keyword; or, regions are grown based on the seed values in Seed. The number of regions grown from the seeds are then counted; otherwise, the separate regions in image are counted.

Example

; Look for a maximum of 250 regions.
image = IMAGE_READ(!IP_Data + 'blobs.tif')
; Grow and count regions in the image based on the amplitude 
; values in the values array.
values = INDGEN(250) + 1 
n_regions = REGION_COUNT(image('pixels'), $
search_values = values, seeds = region_seeds)
; Print the actual number of regions found.
PRINT, n_regions
; Print the seed pixel for each region.
PRINT, region_seeds

See Also

REGION_FIND, REGION_GROW, REGION_STATS