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)
void imAnalyzeMeasureArea (const imImage *image, int *area, int region_count)
void imAnalyzeMeasurePerimArea (const imImage *image, float *perimarea, int region_count)
void imAnalyzeMeasureCentroid (const imImage *image, const int *area, int region_count, float *cx, float *cy)
void imAnalyzeMeasurePrincipalAxis (const imImage *image, const int *area, const float *cx, const float *cy, const int region_count, float *major_slope, float *major_length, float *minor_slope, float *minor_length)
void imAnalyzeMeasureHoles (const imImage *image, int connect, int region_count, int *holes_count, int *holes_area, float *holes_perim)
void imAnalyzeMeasurePerimeter (const imImage *image, float *perim, int region_count)
void imProcessPerimeterLine (const imImage *src_image, imImage *dst_image)
void imProcessRemoveByArea (const imImage *src_image, imImage *dst_image, int connect, int start_size, int end_size, int inside)
void 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 
)

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

im.AnalyzeFindRegions(src_image: imImage, dst_image: imImage, connect: number, touch_border: boolean) -> count: number [in Lua 5] 
im.AnalyzeFindRegionsNew(image: imImage, connect: number, touch_border: boolean) -> count: number, new_image: imImage [in Lua 5] 
void 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.

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

The returned table is zero indexed.

void imAnalyzeMeasurePerimArea ( const imImage image,
float *  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.

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

The returned table is zero indexed.

void imAnalyzeMeasureCentroid ( const imImage image,
const int *  area,
int  region_count,
float *  cx,
float *  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.

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

The returned tables are zero indexed.

void imAnalyzeMeasurePrincipalAxis ( const imImage image,
const int *  area,
const float *  cx,
const float *  cy,
const int  region_count,
float *  major_slope,
float *  major_length,
float *  minor_slope,
float *  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.

im.AnalyzeMeasurePrincipalAxis(image: imImage, [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.

void imAnalyzeMeasureHoles ( const imImage image,
int  connect,
int  region_count,
int *  holes_count,
int *  holes_area,
float *  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.

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

The returned tables are zero indexed.

void imAnalyzeMeasurePerimeter ( const imImage image,
float *  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.

im.AnalyzeMeasurePerimeter(image: imImage) -> perim: table of numbers [in Lua 5] 
void 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.

im.ProcessPerimeterLine(src_image: imImage, dst_image: imImage) [in Lua 5] 
im.ProcessPerimeterLineNew(image: imImage) -> new_image: imImage [in Lua 5] 
void 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) [in Lua 5] 
im.ProcessRemoveByAreaNew(image: imImage, connect: number, start_size: number, end_size: number, inside: boolean) -> new_image: imImage [in Lua 5] 
void 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.

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