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

float imCalcRMSError (const imImage *image1, const imImage *image2)
float imCalcSNR (const imImage *src_image, const imImage *noise_image)
unsigned long imCalcCountColors (const imImage *image)
void imCalcGrayHistogram (const imImage *image, unsigned long *histo, int cumulative)
void 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)
void imCalcImageStatistics (const imImage *image, imStats *stats)
void imCalcHistogramStatistics (const imImage *image, imStats *stats)
void imCalcHistoImageStatistics (const imImage *image, int *median, int *mode)
void imCalcPercentMinMax (const imImage *image, float percent, int ignore_zero, int *min, int *max)

Detailed Description

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

Function Documentation

float imCalcRMSError ( const imImage image1,
const imImage image2 
)

Calculates the RMS error between two images (Root Mean Square Error).

im.CalcRMSError(image1: imImage, image2: imImage) -> rms: number [in Lua 5] 
float imCalcSNR ( const imImage src_image,
const imImage noise_image 
)

Calculates the SNR of an image and its noise (Signal Noise Ratio).

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

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.

im.CalcCountColors(image: imImage) -> count: number [in Lua 5] 
void 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.

im.CalcGrayHistogram(image: imImage, cumulative: boolean) -> histo: table of numbers [in Lua 5] 
void 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.

im.CalcHistogram(image: imImage, plane: number, cumulative: 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 
)

Alocates 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 indices 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.
Not available in Lua.

void 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.

im.CalcImageStatistics(image: imImage) -> 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.

void 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.

im.CalcHistogramStatistics(image: imImage) -> stats: table [in Lua 5] 
void 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.

im.CalcHistoImageStatistics(image: imImage) -> median: number, mode: number [in Lua 5] 
void imCalcPercentMinMax ( const imImage image,
float  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.

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