libcrn  3.9.5
A document image processing library
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Static Public Member Functions | List of all members
crn::Differential Class Reference

Differential computation on images. More...

#include <CRNDifferential.h>

Public Types

enum  RGBProjection { RGBProjection::ABSMAX, RGBProjection::SUM }
 

Public Member Functions

 ~Differential ()=default
 Destructor. More...
 
 Differential (const Differential &)=delete
 
 Differential (Differential &&)=default
 
Differentialoperator= (const Differential &)=delete
 
Differentialoperator= (Differential &&)=default
 
ImageDoubleGrayGetLx () noexcept
 Returns a reference to the internal x derivate. More...
 
const ImageDoubleGrayGetLx () const
 Returns a reference to the internal x derivate. More...
 
ImageDoubleGrayGetLy () noexcept
 Returns a reference to the internal y derivate. More...
 
const ImageDoubleGrayGetLy () const
 Returns a reference to the internal y derivate. More...
 
ImageDoubleGrayGetLx2Ly2 () noexcept
 Returns a reference to the internal first derivatives norm. More...
 
const ImageDoubleGrayGetLx2Ly2 () const
 Returns a reference to the internal first derivatives norm. More...
 
const ImageDoubleGrayGetLxx ()
 Returns a reference to the internal xx derivate. More...
 
const ImageDoubleGrayGetLxy ()
 Returns a reference to the internal xy derivate. More...
 
const ImageDoubleGrayGetLyx ()
 Returns a reference to the internal yx derivate. More...
 
const ImageDoubleGrayGetLyy ()
 Returns a reference to the internal yy derivate. More...
 
void Diffuse (size_t maxiter, double maxdiv=std::numeric_limits< double >::max())
 Diffuses the gradient. More...
 
ImageDoubleGray MakeLw ()
 Returns the derivative of the normal to the isophotes. More...
 
ImageDoubleGray MakeLvv ()
 Returns the second derivative of the tangent to the isophote. More...
 
ImageDoubleGray MakeLww ()
 Returns the second derivative of the normal to the isophote. More...
 
ImageDoubleGray MakeLvw ()
 Returns the cross derivative of the tangent and normal to the isophote. More...
 
ImageDoubleGray MakeKappa1 ()
 Returns the first eigenvalue of the Hessian as an image. More...
 
ImageDoubleGray MakeKappa2 ()
 Returns the second eigenvalue of the Hessian as an image. More...
 
ImageDoubleGray MakeHessianCorner (double s=0.1)
 Returns the Hessian corner image. More...
 
ImageDoubleGray MakeLaplacian ()
 Returns the Laplacian image. More...
 
ImageDoubleGray MakeIsophoteCurvature ()
 Returns the isophote curvature image. More...
 
ImageDoubleGray MakeFlowlineCurvature ()
 Returns the flowline curvature image. More...
 
ImageDoubleGray MakeEdge ()
 Returns the edge image. More...
 
ImageDoubleGray MakeCorner ()
 Returns the corner image. More...
 
ImageDoubleGray MakeGaussianCurvature ()
 Returns the Gaussian curvature image. More...
 
ImageGradient MakeImageGradient ()
 Returns the gradient image. More...
 
ImageDoubleGray MakeGradientModule ()
 Returns the gradient module image. More...
 
ImageGray MakeGradientCurvature ()
 Returns the gradient curvature image. More...
 
ImageDoubleGray MakeCanny ()
 Returns Canny's edge detector image. More...
 
ImageDoubleGray MakeDivergence ()
 Creates the continuous image skeleton. More...
 
double AutoThreshold ()
 Computes the best threshold for lx2ly2. More...
 
double GetThreshold () const noexcept
 Gets the threshold for lx2ly2. More...
 
void SetThreshold (double d) noexcept
 Sets the threshold for lx2ly2. More...
 
bool IsSignificant (size_t i) const noexcept
 Is a pixel significant. More...
 
bool IsSignificant (size_t x, size_t y) const noexcept
 Is a pixel significant. More...
 
template<typename T >
void FillNonSignificant (Image< T > &img, T val=T(0)) const
 Cleans an image of non-significant values. More...
 

Static Public Member Functions

static Differential NewGaussian (const ImageRGB &src, RGBProjection proj, double sigma)
 Convolution with Gaussian derivatives. More...
 
static Differential NewHalfDiff (const ImageRGB &src, RGBProjection proj)
 Alternate half derivatives. More...
 
static Differential NewHalfDiffAbsMax (const ImageRGB &src, RGBProjection proj)
 AbsMax half derivatives. More...
 
static Differential NewHalfDiffAbsMin (const ImageRGB &src, RGBProjection proj)
 AbsMin half derivatives. More...
 
template<typename T >
static Differential NewGaussian (const Image< T > &src, double sigma)
 Convolution with Gaussian derivatives. More...
 
template<typename T >
static Differential NewHalfDiff (const Image< T > &src)
 Alternate half derivatives. More...
 
template<typename T >
static Differential NewHalfDiffAbsMax (const Image< T > &src)
 AbsMax half derivatives. More...
 
template<typename T >
static Differential NewHalfDiffAbsMin (const Image< T > &src)
 AbsMin half derivatives. More...
 
static Differential NewGaussian (const ImageDoubleGray &src, double sigma)
 Convolution with Gaussian derivatives. More...
 
static Differential NewHalfDiff (const ImageDoubleGray &src)
 Alternate half derivatives. More...
 
static Differential NewHalfDiffAbsMax (const ImageDoubleGray &src)
 AbsMax half derivatives. More...
 
static Differential NewHalfDiffAbsMin (const ImageDoubleGray &src)
 AbsMin half derivatives. More...
 

Detailed Description

Differential computation on images.

This class extracts differential features from an image.

Attention
Heavy memory usage (up to 40 times the original image size)!
Author
Yann LEYDIER
Date
Jan 2015
Version
0.5

Definition at line 50 of file CRNDifferential.h.

Member Enumeration Documentation

Enumerator
ABSMAX 
SUM 

Definition at line 53 of file CRNDifferential.h.

Constructor & Destructor Documentation

crn::Differential::~Differential ( )
default

Destructor.

crn::Differential::Differential ( const Differential )
delete
crn::Differential::Differential ( Differential &&  )
default

Member Function Documentation

double Differential::AutoThreshold ( )

Computes the best threshold for lx2ly2.

Computes the best mingrad value

Returns
The computed minimal gradient magnitude value
Todo:
find the right division factor for the deviation

Definition at line 827 of file CRNDifferential.cpp.

void Differential::Diffuse ( size_t  maxiter,
double  maxdiv = std::numeric_limits<double>::max() 
)

Diffuses the gradient.

Diffuses the gradient. All other buffers are freed in order to be recomputed if needed.

Author
Yann LEYDIER
Parameters
[in]maxiterMaximum number of iterations
[in]maxdivMaximum divergence allowed to modify a pixel, value in ]0.0, 2.0] or >2 to always modify

Definition at line 864 of file CRNDifferential.cpp.

template<typename T >
void crn::Differential::FillNonSignificant ( Image< T > &  img,
val = T(0) 
) const
inline

Cleans an image of non-significant values.

Exceptions
ExceptionDimensionwrong image dimensions
Parameters
[in]imgthe image to clean
[in]valthe value that represents non-significant pixels

Definition at line 170 of file CRNDifferential.h.

ImageDoubleGray& crn::Differential::GetLx ( )
inlinenoexcept

Returns a reference to the internal x derivate.

Definition at line 94 of file CRNDifferential.h.

const ImageDoubleGray& crn::Differential::GetLx ( ) const
inline

Returns a reference to the internal x derivate.

Definition at line 96 of file CRNDifferential.h.

ImageDoubleGray& crn::Differential::GetLx2Ly2 ( )
inlinenoexcept

Returns a reference to the internal first derivatives norm.

Definition at line 102 of file CRNDifferential.h.

const ImageDoubleGray& crn::Differential::GetLx2Ly2 ( ) const
inline

Returns a reference to the internal first derivatives norm.

Definition at line 104 of file CRNDifferential.h.

const ImageDoubleGray & Differential::GetLxx ( )

Returns a reference to the internal xx derivate.

Returns the x second derivate. Computes it if needed.

Returns
the newly created image

Definition at line 480 of file CRNDifferential.cpp.

const ImageDoubleGray & Differential::GetLxy ( )

Returns a reference to the internal xy derivate.

Returns the xy derivate. Computes it if needed.

Returns
the newly created image

Definition at line 517 of file CRNDifferential.cpp.

ImageDoubleGray& crn::Differential::GetLy ( )
inlinenoexcept

Returns a reference to the internal y derivate.

Definition at line 98 of file CRNDifferential.h.

const ImageDoubleGray& crn::Differential::GetLy ( ) const
inline

Returns a reference to the internal y derivate.

Definition at line 100 of file CRNDifferential.h.

const ImageDoubleGray & Differential::GetLyx ( )

Returns a reference to the internal yx derivate.

Returns the yx derivate. Computes it if needed.

Returns
the newly created image

Definition at line 536 of file CRNDifferential.cpp.

const ImageDoubleGray & Differential::GetLyy ( )

Returns a reference to the internal yy derivate.

Returns the y second derivate. Computes it if needed.

Returns
the newly created image

Definition at line 498 of file CRNDifferential.cpp.

double crn::Differential::GetThreshold ( ) const
inlinenoexcept

Gets the threshold for lx2ly2.

Definition at line 158 of file CRNDifferential.h.

bool crn::Differential::IsSignificant ( size_t  i) const
inlinenoexcept

Is a pixel significant.

Definition at line 162 of file CRNDifferential.h.

bool crn::Differential::IsSignificant ( size_t  x,
size_t  y 
) const
inlinenoexcept

Is a pixel significant.

Definition at line 164 of file CRNDifferential.h.

ImageDoubleGray Differential::MakeCanny ( )

Returns Canny's edge detector image.

Canny's edge detector image

Returns
Canny's edge detector image

Definition at line 959 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeCorner ( )

Returns the corner image.

Returns the corner image. Lvv * Lw²

Returns
the newly created image

Definition at line 703 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeDivergence ( )

Creates the continuous image skeleton.

Creates a continuous skeleton from gradient divergence.

Returns
an image of the skeleton

Definition at line 911 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeEdge ( )

Returns the edge image.

Returns the edge image. Lww / Lw

Returns
the newly created image

Definition at line 685 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeFlowlineCurvature ( )

Returns the flowline curvature image.

Returns the flowline curvature image. Lvw / Lw

Returns
the newly created image

Definition at line 667 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeGaussianCurvature ( )

Returns the Gaussian curvature image.

Returns the Gaussian curvature image. Lxx*Lyy - Lxy*Lyx

Returns
the newly created image

Definition at line 717 of file CRNDifferential.cpp.

ImageGray Differential::MakeGradientCurvature ( )

Returns the gradient curvature image.

Returns the gradient curvature image

Returns
the newly created image.

Definition at line 742 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeGradientModule ( )

Returns the gradient module image.

Returns the gradient module image

Returns
the newly created image, nullptr if failed.

Definition at line 731 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeHessianCorner ( double  s = 0.1)

Returns the Hessian corner image.

Returns the Hessian corner image. Lxx*Lyy - Lxy*Lyx - s * (Lxx+Lyy)²

Parameters
[in]sa value between 0.04 and 0.15
Returns
the newly created image

Definition at line 808 of file CRNDifferential.cpp.

ImageGradient Differential::MakeImageGradient ( )

Returns the gradient image.

Returns the gradient image

Returns
the newly created image

Definition at line 753 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeIsophoteCurvature ( )

Returns the isophote curvature image.

Returns the isophote curvature image. Lvv / Lw

Returns
the newly created image

Definition at line 649 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeKappa1 ( )

Returns the first eigenvalue of the Hessian as an image.

Returns the first eigenvalue of the Hessian as an image. (Lxx+Lyy + sqrt(|(Lxx+Lyy)² - 4*(Lxx*Lyy - Lxy*Lyx)|)) / 2

Returns
the newly created image

Definition at line 766 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeKappa2 ( )

Returns the second eigenvalue of the Hessian as an image.

Returns the second eigenvalue of the Hessian as an image. (Lxx+Lyy - sqrt(|(Lxx+Lyy)² - 4*(Lxx*Lyy - Lxy*Lyx)|)) / 2

Returns
the newly created image

Definition at line 787 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeLaplacian ( )

Returns the Laplacian image.

Returns the laplacian image. Lxx + Lyy

Returns
the newly created image

Definition at line 635 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeLvv ( )

Returns the second derivative of the tangent to the isophote.

Returns the second derivate of the tangent to the isophotes. (Lx²*Lyy + Ly²*Lxx - Lx*Ly*(Lxy + Lyx)) / (Lx² + Ly²) Computes it if needed.

Returns
the newly created image

Definition at line 568 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeLvw ( )

Returns the cross derivative of the tangent and normal to the isophote.

Returns the cross derivative of the tangent and the normal to the isophotes. (Lx*Ly*(Lyy-Lxx) + Lxy*Lx² - Lyx*Ly²) / (Lx² + Ly²) Computes it if needed.

Returns
the newly created image

Definition at line 612 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeLw ( )

Returns the derivative of the normal to the isophotes.

Returns the first derivate of the normal to the isophotes. sqrt(Lx²+Ly²). Computes it if needed.

Returns
the newly created image

Definition at line 554 of file CRNDifferential.cpp.

ImageDoubleGray Differential::MakeLww ( )

Returns the second derivative of the normal to the isophote.

Returns the second derivative of the normal to the isophotes. (Lx²*Lxx + Ly²*Lyy + Lx*Ly*(Lxy + Lyx)) / (Lx² + Ly²) Computes it if needed.

Returns
the newly created image

Definition at line 590 of file CRNDifferential.cpp.

Differential Differential::NewGaussian ( const ImageRGB src,
RGBProjection  proj,
double  sigma 
)
static

Convolution with Gaussian derivatives.

Convolution with Gaussian derivatives.

Exceptions
ExceptionDomainsigma<0
Parameters
[in]srcthe image to derivate
[in]projthe method of projection from R, G and B derivatives to a single derivative. If proj = ABSMAX, the 2nd derivatives are not cached and will be approximated.
[in]sigmathe standard deviation of the Gaussian (if null, the derivation convolutions are [-1 0 1] and [1 -2 1])
Returns
a new Differential object

Definition at line 212 of file CRNDifferential.cpp.

template<typename T >
static Differential crn::Differential::NewGaussian ( const Image< T > &  src,
double  sigma 
)
inlinestatic

Convolution with Gaussian derivatives.

Definition at line 64 of file CRNDifferential.h.

Differential Differential::NewGaussian ( const ImageDoubleGray src,
double  sigma 
)
static

Convolution with Gaussian derivatives.

Convolution with Gaussian derivatives

Exceptions
ExceptionDomainsigma<0
Parameters
[in]srcthe image to derivate
[in]sigmathe standard deviation of the Gaussian (if null, the derivation convolutions are [-1 0 1] and [1 -2 1])
Returns
a new Differential object

Definition at line 403 of file CRNDifferential.cpp.

Differential Differential::NewHalfDiff ( const ImageRGB src,
RGBProjection  proj 
)
static

Alternate half derivatives.

Alternate half derivatives (left and top for 1st derivatives and right and bottom for 2nd derivatives)

Parameters
[in]srcthe image to derivate
[in]projthe method of projection from R, G and B derivatives to a single derivative
Returns
a new Differential object

Definition at line 253 of file CRNDifferential.cpp.

template<typename T >
static Differential crn::Differential::NewHalfDiff ( const Image< T > &  src)
inlinestatic

Alternate half derivatives.

Definition at line 67 of file CRNDifferential.h.

Differential Differential::NewHalfDiff ( const ImageDoubleGray src)
static

Alternate half derivatives.

Alternate half derivatives (left and top for 1st derivatives and right and bottom for 2nd derivatives)

Parameters
[in]srcthe image to derivate
Returns
a new Differential object

Definition at line 413 of file CRNDifferential.cpp.

Differential Differential::NewHalfDiffAbsMax ( const ImageRGB src,
RGBProjection  proj 
)
static

AbsMax half derivatives.

AbsMax half derivatives. The 2nd derivatives are not cached and will be approximated.

Parameters
[in]srcthe image to derivate
[in]projthe method of projection from R, G and B derivatives to a single derivative

Definition at line 299 of file CRNDifferential.cpp.

template<typename T >
static Differential crn::Differential::NewHalfDiffAbsMax ( const Image< T > &  src)
inlinestatic

AbsMax half derivatives.

Definition at line 70 of file CRNDifferential.h.

Differential Differential::NewHalfDiffAbsMax ( const ImageDoubleGray src)
static

AbsMax half derivatives.

AbsMax half derivatives. The 2nd derivatives are not cached and will be approximated.

Parameters
[in]srcthe image to derivate
Returns
a new Differential object

Definition at line 430 of file CRNDifferential.cpp.

Differential Differential::NewHalfDiffAbsMin ( const ImageRGB src,
RGBProjection  proj 
)
static

AbsMin half derivatives.

AbsMin half derivatives. The 2nd derivatives are not cached and will be approximated.

Parameters
[in]srcthe image to derivate
[in]projthe method of projection from R, G and B derivatives to a single derivative

Definition at line 350 of file CRNDifferential.cpp.

template<typename T >
static Differential crn::Differential::NewHalfDiffAbsMin ( const Image< T > &  src)
inlinestatic

AbsMin half derivatives.

Definition at line 73 of file CRNDifferential.h.

Differential Differential::NewHalfDiffAbsMin ( const ImageDoubleGray src)
static

AbsMin half derivatives.

AbsMin half derivatives. The 2nd derivatives are not cached and will be approximated.

Parameters
[in]srcthe image to derivate
Returns
a new Differential object

Definition at line 449 of file CRNDifferential.cpp.

Differential& crn::Differential::operator= ( const Differential )
delete
Differential& crn::Differential::operator= ( Differential &&  )
default
void crn::Differential::SetThreshold ( double  d)
inlinenoexcept

Sets the threshold for lx2ly2.

Definition at line 160 of file CRNDifferential.h.


The documentation for this class was generated from the following files: