Classes | Macros | Functions
vil_math.h File Reference

Various mathematical manipulations of 2D images. More...

#include <vector>
#include <cmath>
#include <algorithm>
#include <cassert>
#include <vil/vil_image_view.h>
#include <vil/vil_image_resource.h>
#include <vil/vil_view_as.h>
#include <vil/vil_plane.h>
#include <vil/vil_transform.h>
#include <vil/vil_config.h>

Go to the source code of this file.

Classes

class  vil_math_sqrt_functor
 Functor class to compute square roots (returns zero if x<0). More...
 
class  vil_math_scale_functor
 Functor class to scale by s. More...
 
class  vil_math_scale_and_translate_functor
 Functor class to scale by s and translate (offset) by t. More...
 
class  vil_math_log_functor
 Functor class to compute logarithms (returns zero if x<=0). More...
 

Macros

#define macro(F, T)
 

Functions

template<class T >
void vil_math_value_range (const vil_image_view< T > &view, T &min_value, T &max_value)
 Compute minimum and maximum values over view. More...
 
template<>
void vil_math_value_range (const vil_image_view< vil_rgb< vxl_byte > > &rgb_view, vil_rgb< vxl_byte > &min_value, vil_rgb< vxl_byte > &max_value)
 Compute minimum and maximum values over view. More...
 
template<>
void vil_math_value_range (const vil_image_view< vil_rgb< float > > &rgb_view, vil_rgb< float > &min_value, vil_rgb< float > &max_value)
 Compute minimum and maximum values over view. More...
 
template<class T >
void vil_math_value_range_percentiles (const vil_image_view< T > &im, const std::vector< double > &fraction, std::vector< T > &value)
 Compute the values corresponding to several percentiles of the range of im. More...
 
template<class T >
void vil_math_value_range_percentile (const vil_image_view< T > &im, const double fraction, T &value)
 Compute the value corresponding to a percentile of the range of im. More...
 
template<class imT , class sumT >
sumT vil_math_ssd (const vil_image_view< imT > &imA, const vil_image_view< imT > &imB, sumT)
 Sum of squared differences between two images. More...
 
template<class imT , class sumT >
sumT vil_math_ssd_complex (const vil_image_view< std::complex< imT > > &imA, const vil_image_view< std::complex< imT > > &imB, sumT)
 Sum squared magnitude differences between two complex images. More...
 
template<class aT , class sumT >
void vil_math_mean_over_planes (const vil_image_view< aT > &src, vil_image_view< sumT > &dest)
 Calc the mean of each pixel over all the planes. More...
 
template<class inT , class outT , class sumT >
void vil_math_mean_over_planes (const vil_image_view< inT > &src, vil_image_view< outT > &dest, sumT)
 Calc the mean of each pixel over all the planes. More...
 
template<class imT , class sumT >
void vil_math_sum (sumT &sum, const vil_image_view< imT > &im, unsigned p)
 Sum of elements in plane p of image. More...
 
template<class imT , class sumT >
void vil_math_mean (sumT &mean, const vil_image_view< imT > &im, unsigned p)
 Mean of elements in plane p of image. More...
 
void vil_math_median_unimplemented ()
 
template<class imT >
void vil_math_median (imT &median, const vil_image_view< imT > &im, unsigned p)
 Median of elements in plane p of an image. More...
 
template<>
void vil_math_median (vxl_byte &median, const vil_image_view< vxl_byte > &im, unsigned p)
 
template<class imT , class sumT >
void vil_math_sum_squares (sumT &sum, sumT &sum_sq, const vil_image_view< imT > &im, unsigned p)
 Sum of squares of elements in plane p of image. More...
 
template<class imT , class sumT >
bool vil_math_sum_squares (sumT &sum, sumT &sum_sq, unsigned int &count, const vil_image_view< imT > &im, const vil_image_view< bool > &mask, unsigned p)
 Sum of squares of masked elements in plane p of image. More...
 
template<class imT , class sumT >
void vil_math_mean_and_variance (sumT &mean, sumT &var, const vil_image_view< imT > &im, unsigned p)
 Mean and variance of elements in plane p of image. More...
 
template<class imT , class sumT >
bool vil_math_mean_and_variance (sumT &mean, sumT &var, const vil_image_view< imT > &im, const vil_image_view< bool > &mask, unsigned p)
 Mean and variance of masked elements in plane p of image. More...
 
template<class sumT >
bool vil_math_mean_and_variance (sumT &mean, sumT &var, const vil_image_resource_sptr im, const vil_image_view< bool > &mask, unsigned p)
 Mean and variance of masked elements in plane p for vil_image_resource. More...
 
template<class T >
void vil_math_sqrt (vil_image_view< T > &image)
 Compute square-root of each pixel element (or zero if negative). More...
 
template<class T >
void vil_math_truncate_range (vil_image_view< T > &image, T min_v, T max_v)
 Truncate each pixel value so it fits into range [min_v,max_v]. More...
 
template<class T >
void vil_math_scale_values (vil_image_view< T > &image, double scale)
 Multiply values in-place in image view by scale. More...
 
template<class imT , class offsetT >
void vil_math_scale_and_offset_values (vil_image_view< imT > &image, double scale, offsetT offset)
 Multiply values in-place in image view by scale and add offset. More...
 
template<class imT >
void vil_math_normalise (vil_image_view< imT > &image)
 Scale and offset values so their mean is zero and their variance is one. More...
 
template<class srcT , class destT >
void vil_math_rms (const vil_image_view< srcT > &src, vil_image_view< destT > &dest)
 Computes RMS of each pixel over the planes of src image. More...
 
template<class srcT , class destT >
void vil_math_rss (const vil_image_view< srcT > &src, vil_image_view< destT > &dest)
 Computes Root Sum of Squares of each pixel over the planes of src image. More...
 
template<class srcT , class destT >
void vil_math_sum_sqr (const vil_image_view< srcT > &src, vil_image_view< destT > &dest)
 Computes sum of squares of each pixel over the planes of src image. More...
 
template<class aT , class bT , class sumT >
void vil_math_image_sum (const vil_image_view< aT > &imA, const vil_image_view< bT > &imB, vil_image_view< sumT > &im_sum)
 Compute sum of two images (im_sum = imA+imB). More...
 
template<class aT , class bT , class sumT >
void vil_math_image_product (const vil_image_view< aT > &imA, const vil_image_view< bT > &imB, vil_image_view< sumT > &im_product)
 Compute pixel-wise product of two images (im_prod(i,j) = imA(i,j)*imB(i,j). More...
 
template<class aT , class bT , class maxT >
void vil_math_image_max (const vil_image_view< aT > &imA, const vil_image_view< bT > &imB, vil_image_view< maxT > &im_max)
 Compute the max of two images (im_max = max(imA, imB)). More...
 
template<class aT , class bT , class minT >
void vil_math_image_min (const vil_image_view< aT > &imA, const vil_image_view< bT > &imB, vil_image_view< minT > &im_min)
 Compute the min of two images (im_min = min(imA, imB)). More...
 
template<class aT , class bT , class sumT >
void vil_math_image_ratio (const vil_image_view< aT > &imA, const vil_image_view< bT > &imB, vil_image_view< sumT > &im_ratio)
 Compute pixel-wise ratio of two images : im_ratio(i,j) = imA(i,j)/imB(i,j). More...
 
template<class aT , class bT , class sumT >
void vil_math_image_difference (const vil_image_view< aT > &imA, const vil_image_view< bT > &imB, vil_image_view< sumT > &im_sum)
 Compute difference of two images (im_sum = imA-imB). More...
 
template<class aT , class bT , class dT >
void vil_math_image_abs_difference_1d_generic (const aT *pxA, std::ptrdiff_t isA, const bT *pxB, std::ptrdiff_t isB, dT *pxD, std::ptrdiff_t isD, unsigned len)
 Compute absolute difference of two 1D images (im_sum = |imA-imB|). More...
 
template<class aT , class bT , class dT >
void vil_math_image_abs_difference_1d (const aT *pxA, std::ptrdiff_t isA, const bT *pxB, std::ptrdiff_t isB, dT *pxD, std::ptrdiff_t isD, unsigned len)
 Compute absolute difference of two 1D images (im_sum = |imA-imB|). More...
 
template<class aT , class bT , class dT >
void vil_math_image_abs_difference (const vil_image_view< aT > &imA, const vil_image_view< bT > &imB, vil_image_view< dT > &imD)
 Compute absolute difference of two images (im_sum = |imA-imB|). More...
 
template<class aT , class bT >
double vil_math_image_abs_difference (const vil_image_view< aT > &imA, const vil_image_view< bT > &imB)
 Compute sum of absolute difference between two images (|imA-imB|). More...
 
template<class aT , class bT , class magT >
void vil_math_image_vector_mag (const vil_image_view< aT > &imA, const vil_image_view< bT > &imB, vil_image_view< magT > &im_mag)
 Compute magnitude of two images taken as vector components, sqrt(A^2 + B^2). More...
 
template<class aT , class bT , class scaleT >
void vil_math_add_image_fraction (vil_image_view< aT > &imA, scaleT fa, const vil_image_view< bT > &imB, scaleT fb)
 imA = fa*imA + fb*imB (Useful for moving averages!). More...
 
template<class aT , class sumT >
void vil_math_integral_image (const vil_image_view< aT > &imA, vil_image_view< sumT > &im_sum)
 Compute integral image im_sum(i+1,j+1) = sum (x<=i,y<=j) imA(x,y). More...
 
template<class aT , class sumT >
void vil_math_integral_sqr_image (const vil_image_view< aT > &imA, vil_image_view< sumT > &im_sum, vil_image_view< sumT > &im_sum_sq)
 Compute integral image im_sum_sq(i+1,j+1) = sum (x<=i,y<=j) imA(x,y)^2. More...
 

Detailed Description

Various mathematical manipulations of 2D images.

Author
Tim Cootes

Definition in file vil_math.h.

Macro Definition Documentation

◆ macro

#define macro (   F,
 
)
Value:
case F : \
return vil_math_mean_and_variance(mean, var, \
static_cast<vil_image_view<T >&>(*(im->get_view())), \
mask, p); \
Concrete view of image data of type T held in memory.
Definition: vil_fwd.h:13
void vil_math_mean_and_variance(sumT &mean, sumT &var, const vil_image_view< imT > &im, unsigned p)
Mean and variance of elements in plane p of image.
Definition: vil_math.h:350

Function Documentation

◆ vil_math_add_image_fraction()

template<class aT , class bT , class scaleT >
void vil_math_add_image_fraction ( vil_image_view< aT > &  imA,
scaleT  fa,
const vil_image_view< bT > &  imB,
scaleT  fb 
)
inline

imA = fa*imA + fb*imB (Useful for moving averages!).

Can do running sum using vil_add_image_fraction(running_mean,1-f,new_im,f) to update current mean by a fraction f of new_im

Definition at line 1060 of file vil_math.h.

◆ vil_math_image_abs_difference() [1/2]

template<class aT , class bT , class dT >
void vil_math_image_abs_difference ( const vil_image_view< aT > &  imA,
const vil_image_view< bT > &  imB,
vil_image_view< dT > &  imD 
)
inline

Compute absolute difference of two images (im_sum = |imA-imB|).

Definition at line 955 of file vil_math.h.

◆ vil_math_image_abs_difference() [2/2]

template<class aT , class bT >
double vil_math_image_abs_difference ( const vil_image_view< aT > &  imA,
const vil_image_view< bT > &  imB 
)
inline

Compute sum of absolute difference between two images (|imA-imB|).

Definition at line 988 of file vil_math.h.

◆ vil_math_image_abs_difference_1d()

template<class aT , class bT , class dT >
void vil_math_image_abs_difference_1d ( const aT *  pxA,
std::ptrdiff_t  isA,
const bT *  pxB,
std::ptrdiff_t  isB,
dT *  pxD,
std::ptrdiff_t  isD,
unsigned  len 
)
inline

Compute absolute difference of two 1D images (im_sum = |imA-imB|).

Specialize this function for an optimized implementation

Definition at line 941 of file vil_math.h.

◆ vil_math_image_abs_difference_1d_generic()

template<class aT , class bT , class dT >
void vil_math_image_abs_difference_1d_generic ( const aT *  pxA,
std::ptrdiff_t  isA,
const bT *  pxB,
std::ptrdiff_t  isB,
dT *  pxD,
std::ptrdiff_t  isD,
unsigned  len 
)
inline

Compute absolute difference of two 1D images (im_sum = |imA-imB|).

Compute absolute difference of two 1D images (imD = |imA-imB|).

Definition at line 924 of file vil_math.h.

◆ vil_math_image_difference()

template<class aT , class bT , class sumT >
void vil_math_image_difference ( const vil_image_view< aT > &  imA,
const vil_image_view< bT > &  imB,
vil_image_view< sumT > &  im_sum 
)
inline

Compute difference of two images (im_sum = imA-imB).

Definition at line 890 of file vil_math.h.

◆ vil_math_image_max()

template<class aT , class bT , class maxT >
void vil_math_image_max ( const vil_image_view< aT > &  imA,
const vil_image_view< bT > &  imB,
vil_image_view< maxT > &  im_max 
)
inline

Compute the max of two images (im_max = max(imA, imB)).

Definition at line 775 of file vil_math.h.

◆ vil_math_image_min()

template<class aT , class bT , class minT >
void vil_math_image_min ( const vil_image_view< aT > &  imA,
const vil_image_view< bT > &  imB,
vil_image_view< minT > &  im_min 
)
inline

Compute the min of two images (im_min = min(imA, imB)).

Definition at line 808 of file vil_math.h.

◆ vil_math_image_product()

template<class aT , class bT , class sumT >
void vil_math_image_product ( const vil_image_view< aT > &  imA,
const vil_image_view< bT > &  imB,
vil_image_view< sumT > &  im_product 
)
inline

Compute pixel-wise product of two images (im_prod(i,j) = imA(i,j)*imB(i,j).

If images have the same number of planes, then im_prod(i,j,p) = imA(i,j,p)*imB(i,j,p). If imB only has one plane, then im_prod(i,j,p) = imA(i,j,p)*imB(i,j,0).

Definition at line 736 of file vil_math.h.

◆ vil_math_image_ratio()

template<class aT , class bT , class sumT >
void vil_math_image_ratio ( const vil_image_view< aT > &  imA,
const vil_image_view< bT > &  imB,
vil_image_view< sumT > &  im_ratio 
)
inline

Compute pixel-wise ratio of two images : im_ratio(i,j) = imA(i,j)/imB(i,j).

Pixels cast to type sumT before calculation. If imB(i,j,p)==0, im_ration(i,j,p)=0

If images have the same number of planes, then im_ratio(i,j,p) = imA(i,j,p)/imB(i,j,p). If imB only has one plane, then im_ratio(i,j,p) = imA(i,j,p)/imB(i,j,0).

Definition at line 847 of file vil_math.h.

◆ vil_math_image_sum()

template<class aT , class bT , class sumT >
void vil_math_image_sum ( const vil_image_view< aT > &  imA,
const vil_image_view< bT > &  imB,
vil_image_view< sumT > &  im_sum 
)
inline

Compute sum of two images (im_sum = imA+imB).

Definition at line 700 of file vil_math.h.

◆ vil_math_image_vector_mag()

template<class aT , class bT , class magT >
void vil_math_image_vector_mag ( const vil_image_view< aT > &  imA,
const vil_image_view< bT > &  imB,
vil_image_view< magT > &  im_mag 
)
inline

Compute magnitude of two images taken as vector components, sqrt(A^2 + B^2).

Definition at line 1020 of file vil_math.h.

◆ vil_math_integral_image()

template<class aT , class sumT >
void vil_math_integral_image ( const vil_image_view< aT > &  imA,
vil_image_view< sumT > &  im_sum 
)
inline

Compute integral image im_sum(i+1,j+1) = sum (x<=i,y<=j) imA(x,y).

Useful thing for quickly computing mean over large regions, as demonstrated in Viola and Jones (CVPR01). The sum of elements in the ni x nj square with corner (i,j) is given by im_sum(i,j)+im_sum(i+ni,j+nj)-im_sum(i+ni,j)-im_sum(i,j+nj)

Definition at line 1091 of file vil_math.h.

◆ vil_math_integral_sqr_image()

template<class aT , class sumT >
void vil_math_integral_sqr_image ( const vil_image_view< aT > &  imA,
vil_image_view< sumT > &  im_sum,
vil_image_view< sumT > &  im_sum_sq 
)
inline

Compute integral image im_sum_sq(i+1,j+1) = sum (x<=i,y<=j) imA(x,y)^2.

Also computes sum im_sum(i+1,j+1) = sum (x<=i,y<=j) imA(x,y)

Useful thing for quickly computing mean and variance over large regions, as demonstrated in Viola and Jones (CVPR01).

The sum of elements in the ni x nj square with corner (i,j) is given by im_sum(i,j)+im_sum(i+ni,j+nj)-im_sum(i+ni,j)-im_sum(i,j+nj)

Similar result holds for sum of squares, allowing rapid calculation of variance etc.

Definition at line 1140 of file vil_math.h.

◆ vil_math_mean()

template<class imT , class sumT >
void vil_math_mean ( sumT &  mean,
const vil_image_view< imT > &  im,
unsigned  p 
)
inline

Mean of elements in plane p of image.

Definition at line 264 of file vil_math.h.

◆ vil_math_mean_and_variance() [1/3]

template<class imT , class sumT >
void vil_math_mean_and_variance ( sumT &  mean,
sumT &  var,
const vil_image_view< imT > &  im,
unsigned  p 
)
inline

Mean and variance of elements in plane p of image.

Definition at line 350 of file vil_math.h.

◆ vil_math_mean_and_variance() [2/3]

template<class imT , class sumT >
bool vil_math_mean_and_variance ( sumT &  mean,
sumT &  var,
const vil_image_view< imT > &  im,
const vil_image_view< bool > &  mask,
unsigned  p 
)
inline

Mean and variance of masked elements in plane p of image.

Definition at line 362 of file vil_math.h.

◆ vil_math_mean_and_variance() [3/3]

template<class sumT >
bool vil_math_mean_and_variance ( sumT &  mean,
sumT &  var,
const vil_image_resource_sptr  im,
const vil_image_view< bool > &  mask,
unsigned  p 
)
inline

Mean and variance of masked elements in plane p for vil_image_resource.

Definition at line 380 of file vil_math.h.

◆ vil_math_mean_over_planes() [1/2]

template<class aT , class sumT >
void vil_math_mean_over_planes ( const vil_image_view< aT > &  src,
vil_image_view< sumT > &  dest 
)
inline

Calc the mean of each pixel over all the planes.

Definition at line 207 of file vil_math.h.

◆ vil_math_mean_over_planes() [2/2]

template<class inT , class outT , class sumT >
void vil_math_mean_over_planes ( const vil_image_view< inT > &  src,
vil_image_view< outT > &  dest,
sumT   
)
inline

Calc the mean of each pixel over all the planes.

Definition at line 229 of file vil_math.h.

◆ vil_math_median() [1/2]

template<class imT >
void vil_math_median ( imT &  median,
const vil_image_view< imT > &  im,
unsigned  p 
)
inline

Median of elements in plane p of an image.

For integral types, if the median is half way between two values, the result will be the floor of the average.

Definition at line 282 of file vil_math.h.

◆ vil_math_median() [2/2]

template<>
void vil_math_median ( vxl_byte &  median,
const vil_image_view< vxl_byte > &  im,
unsigned  p 
)

Definition at line 24 of file vil_math.cxx.

◆ vil_math_median_unimplemented()

void vil_math_median_unimplemented ( )

Definition at line 17 of file vil_math.cxx.

◆ vil_math_normalise()

template<class imT >
void vil_math_normalise ( vil_image_view< imT > &  image)
inline

Scale and offset values so their mean is zero and their variance is one.

Only works on signed types!

Definition at line 543 of file vil_math.h.

◆ vil_math_rms()

template<class srcT , class destT >
void vil_math_rms ( const vil_image_view< srcT > &  src,
vil_image_view< destT > &  dest 
)
inline

Computes RMS of each pixel over the planes of src image.

Dest is a single plane image, $dest(i,j)^2 = 1/np sum_p src(i,j,p)^2$ Summation is performed using type destT

Definition at line 558 of file vil_math.h.

◆ vil_math_rss()

template<class srcT , class destT >
void vil_math_rss ( const vil_image_view< srcT > &  src,
vil_image_view< destT > &  dest 
)
inline

Computes Root Sum of Squares of each pixel over the planes of src image.

Dest is a single plane image, $dest(i,j) = sqrt(sum_p src(i,j,p)^2)$ Differs from RMS by the scaling factor sqrt(nplanes) Summation is performed using type destT

Definition at line 608 of file vil_math.h.

◆ vil_math_scale_and_offset_values()

template<class imT , class offsetT >
void vil_math_scale_and_offset_values ( vil_image_view< imT > &  image,
double  scale,
offsetT  offset 
)
inline

Multiply values in-place in image view by scale and add offset.

Definition at line 524 of file vil_math.h.

◆ vil_math_scale_values()

template<class T >
void vil_math_scale_values ( vil_image_view< T > &  image,
double  scale 
)
inline

Multiply values in-place in image view by scale.

Definition at line 516 of file vil_math.h.

◆ vil_math_sqrt()

template<class T >
void vil_math_sqrt ( vil_image_view< T > &  image)
inline

Compute square-root of each pixel element (or zero if negative).

Definition at line 427 of file vil_math.h.

◆ vil_math_ssd()

template<class imT , class sumT >
sumT vil_math_ssd ( const vil_image_view< imT > &  imA,
const vil_image_view< imT > &  imB,
sumT   
)
inline

Sum of squared differences between two images.

Definition at line 170 of file vil_math.h.

◆ vil_math_ssd_complex()

template<class imT , class sumT >
sumT vil_math_ssd_complex ( const vil_image_view< std::complex< imT > > &  imA,
const vil_image_view< std::complex< imT > > &  imB,
sumT   
)
inline

Sum squared magnitude differences between two complex images.

Definition at line 188 of file vil_math.h.

◆ vil_math_sum()

template<class imT , class sumT >
void vil_math_sum ( sumT &  sum,
const vil_image_view< imT > &  im,
unsigned  p 
)
inline

Sum of elements in plane p of image.

Definition at line 247 of file vil_math.h.

◆ vil_math_sum_sqr()

template<class srcT , class destT >
void vil_math_sum_sqr ( const vil_image_view< srcT > &  src,
vil_image_view< destT > &  dest 
)
inline

Computes sum of squares of each pixel over the planes of src image.

Dest is a single plane image, $dest(i,j) = sum_p src(i,j,p)^2$ Summation is performed using type destT

Definition at line 658 of file vil_math.h.

◆ vil_math_sum_squares() [1/2]

template<class imT , class sumT >
void vil_math_sum_squares ( sumT &  sum,
sumT &  sum_sq,
const vil_image_view< imT > &  im,
unsigned  p 
)
inline

Sum of squares of elements in plane p of image.

Definition at line 297 of file vil_math.h.

◆ vil_math_sum_squares() [2/2]

template<class imT , class sumT >
bool vil_math_sum_squares ( sumT &  sum,
sumT &  sum_sq,
unsigned int &  count,
const vil_image_view< imT > &  im,
const vil_image_view< bool > &  mask,
unsigned  p 
)
inline

Sum of squares of masked elements in plane p of image.

Definition at line 314 of file vil_math.h.

◆ vil_math_truncate_range()

template<class T >
void vil_math_truncate_range ( vil_image_view< T > &  image,
min_v,
max_v 
)
inline

Truncate each pixel value so it fits into range [min_v,max_v].

If value < min_v value=min_v If value > max_v value=max_v

Definition at line 438 of file vil_math.h.

◆ vil_math_value_range() [1/3]

template<class T >
void vil_math_value_range ( const vil_image_view< T > &  view,
T &  min_value,
T &  max_value 
)
inline

Compute minimum and maximum values over view.

Definition at line 28 of file vil_math.h.

◆ vil_math_value_range() [2/3]

template<>
void vil_math_value_range ( const vil_image_view< vil_rgb< vxl_byte > > &  rgb_view,
vil_rgb< vxl_byte > &  min_value,
vil_rgb< vxl_byte > &  max_value 
)
inline

Compute minimum and maximum values over view.

Definition at line 58 of file vil_math.h.

◆ vil_math_value_range() [3/3]

template<>
void vil_math_value_range ( const vil_image_view< vil_rgb< float > > &  rgb_view,
vil_rgb< float > &  min_value,
vil_rgb< float > &  max_value 
)
inline

Compute minimum and maximum values over view.

Definition at line 70 of file vil_math.h.

◆ vil_math_value_range_percentile()

template<class T >
void vil_math_value_range_percentile ( const vil_image_view< T > &  im,
const double  fraction,
T &  value 
)
inline

Compute the value corresponding to a percentile of the range of im.

Percentile is expressed as fraction, e.g. 0.05, or 0.95.

Parameters
imThe image to examine.
fractionThe fraction of the data range (from the lower end).
Return values
valueThe image data value corresponding to the specified percentile.
Note
This function requires the sorting of large parts of the image data and can be very expensive in terms of both processing and memory.

Definition at line 155 of file vil_math.h.

◆ vil_math_value_range_percentiles()

template<class T >
void vil_math_value_range_percentiles ( const vil_image_view< T > &  im,
const std::vector< double > &  fraction,
std::vector< T > &  value 
)
inline

Compute the values corresponding to several percentiles of the range of im.

Percentiles are expressed as fraction, e.g. 0.05, or 0.95.

Parameters
imThe image to examine.
fractionThe fractions of the data range (from the lower end).
Return values
valueThe image data values corresponding to the specified percentiles.
Note
This function requires the sorting of large parts of the image data and can be very expensive in terms of both processing and memory.

Definition at line 90 of file vil_math.h.