Functions

Image Analysis
[Image Processing]

Collaboration diagram for Image Analysis:

Functions

int imAnalyzeFindRegions (const imImage *src_image, imImage *dst_image, int connect, int touch_border, int *region_count)
int imAnalyzeMeasureArea (const imImage *image, int *area, int region_count)
int imAnalyzeMeasurePerimArea (const imImage *image, double *perimarea, int region_count)
int imAnalyzeMeasureCentroid (const imImage *image, const int *area, int region_count, double *cx, double *cy)
int imAnalyzeMeasurePrincipalAxis (const imImage *image, const int *area, const double *cx, const double *cy, const int region_count, double *major_slope, double *major_length, double *minor_slope, double *minor_length)
int imAnalyzeMeasureHoles (const imImage *image, int connect, int region_count, int *holes_count, int *holes_area, double *holes_perim)
int imAnalyzeMeasurePerimeter (const imImage *image, double *perim, int region_count)
int imProcessPerimeterLine (const imImage *src_image, imImage *dst_image)
int imProcessRemoveByArea (const imImage *src_image, imImage *dst_image, int connect, int start_size, int end_size, int inside)
int imProcessFillHoles (const imImage *src_image, imImage *dst_image, int connect)

Detailed Description

See im_process_ana.h

Function Documentation

int imAnalyzeFindRegions ( const imImage src_image,
imImage dst_image,
int  connect,
int  touch_border,
int *  region_count 
)

Find white regions in binary image.
Result is IM_GRAY/IM_USHORT type. Regions can be 4 connected or 8 connected.
The number of regions found is returned in region_count. Background is marked as 0.
Regions touching the border are considered only if touch_border=1. Not using OpenMP when enabled. Returns zero if the counter aborted.

im.AnalyzeFindRegions(src_image: imImage, dst_image: imImage, connect: number, touch_border: boolean) -> counter: boolean, region_count: number [in Lua 5] 
im.AnalyzeFindRegionsNew(image: imImage, connect: number, touch_border: boolean) -> counter: boolean, region_count: number, new_image: imImage [in Lua 5] 
int imAnalyzeMeasureArea ( const imImage image,
int *  area,
int  region_count 
)

Measure the actual area of all regions. Holes are not included.
This is the number of pixels of each region.
Source image is IM_GRAY/IM_USHORT type (the result of imAnalyzeFindRegions).
area has size the number of regions. Returns zero if the counter aborted.

im.AnalyzeMeasureArea(image: imImage, [region_count: number]) -> counter: boolean, area: table of numbers [in Lua 5] 

The returned table is zero indexed.

int imAnalyzeMeasurePerimArea ( const imImage image,
double *  perimarea,
int  region_count 
)

Measure the polygonal area limited by the perimeter line of all regions. Holes are not included.
Notice that some regions may have polygonal area zero.
Source image is IM_GRAY/IM_USHORT type (the result of imAnalyzeFindRegions).
perimarea has size the number of regions. Returns zero if the counter aborted.

im.AnalyzeMeasurePerimArea(image: imImage, [region_count: number]) -> counter: boolean, perimarea: table of numbers [in Lua 5] 

The returned table is zero indexed.

int imAnalyzeMeasureCentroid ( const imImage image,
const int *  area,
int  region_count,
double *  cx,
double *  cy 
)

Calculate the centroid position of all regions. Holes are not included.
Source image is IM_GRAY/IM_USHORT type (the result of imAnalyzeFindRegions).
area, cx and cy have size the number of regions. If area is NULL will be internally calculated. Returns zero if the counter aborted.

im.AnalyzeMeasureCentroid(image: imImage, [area: table of numbers], [region_count: number]) -> counter: boolean, cx: table of numbers, cy: table of numbers [in Lua 5] 

The returned tables are zero indexed.

int imAnalyzeMeasurePrincipalAxis ( const imImage image,
const int *  area,
const double *  cx,
const double *  cy,
const int  region_count,
double *  major_slope,
double *  major_length,
double *  minor_slope,
double *  minor_length 
)

Calculate the principal major axis slope of all regions.
Source image is IM_GRAY/IM_USHORT type (the result of imAnalyzeFindRegions).
data has size the number of regions. If area or centroid are NULL will be internally calculated.
Principal (major and minor) axes are defined to be those axes that pass through the centroid, about which the moment of inertia of the region is, respectively maximal or minimal. Partially using OpenMP when enabled. Returns zero if the counter aborted.

im.AnalyzeMeasurePrincipalAxis(image: imImage, counter: boolean, [area: table of numbers], [cx: table of numbers], [cy: table of numbers], [region_count: number]) 
                              -> major_slope: table of numbers, major_length: table of numbers, minor_slope: table of numbers, minor_length: table of numbers [in Lua 5] 

The returned tables are zero indexed.

int imAnalyzeMeasureHoles ( const imImage image,
int  connect,
int  region_count,
int *  holes_count,
int *  holes_area,
double *  holes_perim 
)

Measure the number of holes of all regions. Optionally computes the holes area and holes perimeter of all regions.
Source image is IM_GRAY/IM_USHORT type (the result of imAnalyzeFindRegions).
count, area and perim has size the number of regions, if some is NULL it will be not calculated. Not using OpenMP when enabled. Returns zero if the counter aborted.

im.AnalyzeMeasureHoles(image: imImage, connect: number, [region_count: number])-> counter: boolean, holes_count: number, holes_area: table of numbers, holes_perim: table of numbers [in Lua 5] 

The returned tables are zero indexed.

int imAnalyzeMeasurePerimeter ( const imImage image,
double *  perim,
int  region_count 
)

Measure the total perimeter of all regions (external and internal).
Source image is IM_GRAY/IM_USHORT type (the result of imAnalyzeFindRegions).
It uses a half-pixel inter distance for 8 neighbors in a perimeter of a 4 connected region.
This function can also be used to measure line length.
perim has size the number of regions. Returns zero if the counter aborted.

im.AnalyzeMeasurePerimeter(image: imImage)-> counter: boolean, perim: table of numbers [in Lua 5] 
int imProcessPerimeterLine ( const imImage src_image,
imImage dst_image 
)

Isolates the perimeter line of gray integer images. Background is defined as being black (0).
It just checks if at least one of the 4 connected neighbors is non zero. Image borders are extended with zeros. Returns zero if the counter aborted.

im.ProcessPerimeterLine(src_image: imImage, dst_image: imImage)-> counter: boolean [in Lua 5] 
im.ProcessPerimeterLineNew(image: imImage) -> counter: boolean, new_image: imImage [in Lua 5] 
int imProcessRemoveByArea ( const imImage src_image,
imImage dst_image,
int  connect,
int  start_size,
int  end_size,
int  inside 
)

Eliminates regions that have area size outside or inside the given interval.
Source and target are a binary images. Regions can be 4 connected or 8 connected.
Can be done in-place. end_size can be zero to indicate no upper limit or an area with width*height size.
When searching inside the region the limits are inclusive (<= size >=), when searching outside the limits are exclusive (> size <).

im.ProcessRemoveByArea(src_image: imImage, dst_image: imImage, connect: number, start_size: number, end_size: number, inside: boolean)-> counter: boolean [in Lua 5] 
im.ProcessRemoveByAreaNew(image: imImage, connect: number, start_size: number, end_size: number, inside: boolean) -> counter: boolean, new_image: imImage [in Lua 5] 
int imProcessFillHoles ( const imImage src_image,
imImage dst_image,
int  connect 
)

Fill holes inside white regions.
Source and target are a binary images. Regions can be 4 connected or 8 connected.
Can be done in-place. Returns zero if the counter aborted.

im.ProcessFillHoles(src_image: imImage, dst_image: imImage, connect: number)-> counter: boolean [in Lua 5] 
im.ProcessFillHolesNew(image: imImage, connect: number) -> counter: boolean, new_image: imImage [in Lua 5]