Data Structures | Typedefs | Functions

Image Statistics
[Image Processing]

Collaboration diagram for Image Statistics:

Data Structures

struct  _imStats
 Numerical Statistics Structure. More...

Typedefs

typedef struct _imStats imStats

Functions

int imCalcRMSError (const imImage *image1, const imImage *image2, double *rmserror)
int imCalcSNR (const imImage *src_image, const imImage *noise_image, double *snr)
int imCalcCountColors (const imImage *image, unsigned long *count)
int imCalcGrayHistogram (const imImage *image, unsigned long *histo, int cumulative)
int imCalcHistogram (const imImage *image, unsigned long *histo, int plane, int cumulative)
void imCalcByteHistogram (const unsigned char *data, int count, unsigned long *histo, int cumulative)
void imCalcUShortHistogram (const unsigned short *data, int count, unsigned long *histo, int cumulative)
void imCalcShortHistogram (const short *data, int count, unsigned long *histo, int cumulative)
unsigned long * imHistogramNew (int data_type, int *hcount)
void imHistogramRelease (unsigned long *histo)
int imHistogramShift (int data_type)
int imHistogramCount (int data_type)
int imCalcImageStatistics (const imImage *image, imStats *stats)
int imCalcHistogramStatistics (const imImage *image, imStats *stats)
int imCalcHistoImageStatistics (const imImage *image, int *median, int *mode)
int imCalcPercentMinMax (const imImage *image, double percent, int ignore_zero, int *min, int *max)

Detailed Description

Operations to calculate some statistics over images.
See im_process_ana.h

Function Documentation

int imCalcRMSError ( const imImage image1,
const imImage image2,
double *  rmserror 
)

Calculates the RMS error between two images (Root Mean Square Error). Returns zero if the counter aborted.

im.CalcRMSError(image1: imImage, image2: imImage) -> counter: boolean, rms: number [in Lua 5] 
int imCalcSNR ( const imImage src_image,
const imImage noise_image,
double *  snr 
)

Calculates the SNR of an image and its noise (Signal Noise Ratio). Returns zero if the counter aborted.

im.CalcSNR(src_image: imImage, noise_image: imImage) -> counter: boolean, snr: number [in Lua 5] 
int imCalcCountColors ( const imImage image,
unsigned long *  count 
)

Count the number of different colors in an image.
Image must be IM_BYTE, but can has all color spaces except IM_CMYK. Data type can be also IM_SHORT or IM_USHORT if color space is IM_GRAY, IM_BINARY or IM_MAP. Not using OpenMP when enabled, when color space depth is greater than 1. Returns zero if the counter aborted.

im.CalcCountColors(image: imImage) -> counter: boolean, count: number [in Lua 5] 
int imCalcGrayHistogram ( const imImage image,
unsigned long *  histo,
int  cumulative 
)

Calculates the gray histogram of an image.
Image must be (IM_BYTE, IM_SHORT or IM_USHORT)/(IM_RGB, IM_GRAY, IM_BINARY or IM_MAP).
If the image is IM_RGB then the histogram of the luma component is calculated.
Histogram is always 256 or 65536 positions long.
When cumulative is different from zero it calculates the cumulative histogram. Returns zero if the counter aborted.

im.CalcGrayHistogram(image: imImage, cumulative: boolean) -> counter: boolean, histo: table of numbers [in Lua 5] 
int imCalcHistogram ( const imImage image,
unsigned long *  histo,
int  plane,
int  cumulative 
)

Calculates the histogram of an image plane.
Image can be IM_BYTE, IM_SHORT or IM_USHORT.
Histogram is always 256 or 65536 positions long.
Where plane is the depth plane to calculate the histogram.
When cumulative is different from zero it calculates the cumulative histogram. Returns zero if the counter aborted.

im.CalcHistogram(image: imImage, plane: number, cumulative: boolean) -> counter: boolean, histo: table of numbers [in Lua 5] 

The returned table is zero indexed.

void imCalcByteHistogram ( const unsigned char *  data,
int  count,
unsigned long *  histo,
int  cumulative 
)

Calculates the histogram of a IM_BYTE data.
Histogram is always 256 positions long.
When cumulative is different from zero it calculates the cumulative histogram. Not available in Lua.

void imCalcUShortHistogram ( const unsigned short *  data,
int  count,
unsigned long *  histo,
int  cumulative 
)

Calculates the histogram of a IM_USHORT data.
Histogram is always 65536 positions long.
When cumulative is different from zero it calculates the cumulative histogram.
Not available in Lua.

void imCalcShortHistogram ( const short *  data,
int  count,
unsigned long *  histo,
int  cumulative 
)

Calculates the histogram of a IM_SHORT data.
Histogram is always 65536 positions long.
Zero is located at 32768 index.
When cumulative is different from zero it calculates the cumulative histogram.
Not available in Lua.

unsigned long* imHistogramNew ( int  data_type,
int *  hcount 
)

Allocates an histogram data based on the image data type.
Data type can be IM_BYTE, IM_SHORT or IM_USHORT.
Not available in Lua.

void imHistogramRelease ( unsigned long *  histo  ) 

Releases the histogram data.
Not available in Lua.

int imHistogramShift ( int  data_type  ) 

Short data type stores the histogram values of negative indexes starting at 0. So the real level is obtained by shifting the zero based index.
Not available in Lua.

int imHistogramCount ( int  data_type  ) 

Returns the histogram size based on the image data type.
For IM_IM_USHORT and IM_SHORT returns 65536 for others returns 256.
Not available in Lua.

int imCalcImageStatistics ( const imImage image,
imStats stats 
)

Calculates the statistics about the image data.
There is one stats for each depth plane. For ex: stats[0]=red stats, stats[0]=green stats, ...
Supports all data types except complex.
Returns zero if the counter aborted.

im.CalcImageStatistics(image: imImage) -> counter: boolean, stats: table [in Lua 5] 

Table contains the following fields: max, min, positive, negative, zeros, mean, stddev. If image depth > 1 then table contains several tables with the previous fields, one for each plane, starting at 0. The same as the imStats structure.

int imCalcHistogramStatistics ( const imImage image,
imStats stats 
)

Calculates the statistics about the image histogram data.
There is one stats for each depth plane. For ex: stats[0]=red stats, stats[0]=green stats, ...
Only IM_BYTE, IM_SHORT and IM_USHORT images are supported. Returns zero if the counter aborted.

im.CalcHistogramStatistics(image: imImage) -> counter: boolean, stats: table [in Lua 5] 
int imCalcHistoImageStatistics ( const imImage image,
int *  median,
int *  mode 
)

Calculates some extra statistics about the image histogram data.
There is one stats for each depth plane.
Only IM_BYTE, IM_SHORT and IM_USHORT images are supported.
mode will be -1 if more than one max is found. Returns zero if the counter aborted.

im.CalcHistoImageStatistics(image: imImage) -> counter: boolean, median: number, mode: number [in Lua 5] 
int imCalcPercentMinMax ( const imImage image,
double  percent,
int  ignore_zero,
int *  min,
int *  max 
)

Calculates the minimum and maximum levels ignoring a given percentage of the histogram count.
Used by imProcessExpandHistogram.
Only IM_BYTE, IM_SHORT and IM_USHORT images are supported.
Returns zero if the counter aborted.

im.CalcPercentMinMax(image: imImage, percent: number, ignore_zero: boolean) -> counter: boolean, min, max: number [in Lua 5]