IM: Image Analysis

IM - An Imaging Tool

Image Analysis
[Image Processing]


Detailed Description

See im_process_ana.h


Functions

int imAnalyzeFindRegions (const imImage *src_image, imImage *dst_image, int connect, int touch_border)
void imAnalyzeMeasureArea (const imImage *image, int *area)
void imAnalyzeMeasurePerimArea (const imImage *image, float *perimarea)
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 *holes_count, int *area, float *perim)
void imAnalyzeMeasurePerimeter (const imImage *image, float *perim)
void imProcessPerimeterLine (const imImage *src_image, imImage *dst_image)
void imProcessPrune (const imImage *src_image, imImage *dst_image, int connect, int start_size, int end_size)
void imProcessFillHoles (const imImage *src_image, imImage *dst_image, int connect)

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.

im.AnalyzeFindRegions(src_image: imImage, dst_image: imImage, connect: number, touch_border: number) -> count: number [in Lua 5] 
im.AnalyzeFindRegionsNew(image: imImage, connect: number, touch_border: number) -> count: number, new_image: imImage [in Lua 5] 

void imAnalyzeMeasureArea const imImage image,
int *  area
 

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
 

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.

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 *  holes_count,
int *  area,
float *  perim
 

Measure the number and area of holes of all regions.
Source image is IM_USHORT type (the result of imAnalyzeFindRegions).
area and perim has size the number of regions, if some is NULL it will be not calculated.

im.AnalyzeMeasureHoles(image: imImage, connect: number, [region_count: number]) -> holes_count: number, area: table of numbers, perim: table of numbers [in Lua 5] 
The returned tables are zero indexed.

void imAnalyzeMeasurePerimeter const imImage image,
float *  perim
 

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 neighboors in a perimeter of a 4 connected region.
This function can also be used to measure line lenght.
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 neighboors 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 imProcessPrune const imImage src_image,
imImage dst_image,
int  connect,
int  start_size,
int  end_size
 

Eliminates regions that have size outside the given interval.
Source and destiny are a binary images. Regions can be 4 connected or 8 connected.
Can be done in-place. end_size can be zero to ignore big objects.

im.ProcessPrune(src_image: imImage, dst_image: imImage, connect: number, start_size: number, end_size: number) [in Lua 5] 
im.ProcessPruneNew(image: imImage, connect: number, start_size: number, end_size: number) -> new_image: imImage [in Lua 5] 

void imProcessFillHoles const imImage src_image,
imImage dst_image,
int  connect
 

Fill holes inside white regions.
Source and destiny 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]