libcrn  3.9.5
A document image processing library
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Modules | Classes | Macros | Typedefs | Functions
Image
+ Collaboration diagram for Image:

Modules

 PDE
 
 Misc images
 
 Bitonal images
 
 Gray images
 
 RGB images
 
 Pixel formats
 

Classes

class  crn::ImageBase
 Base class for images. More...
 
struct  crn::BoolNotBool< T >
 
struct  crn::BoolNotBoolDummy
 
struct  crn::BoolNotBool< bool >
 
class  crn::Image< T >
 Abstract class for images. More...
 
class  crn::SummedAreaTable< T >
 A summed area table. More...
 

Macros

#define FOREACHPIXEL(x, y, img)   for (size_t y = 0; y < (img).GetHeight(); y++) for (size_t x = 0; x < (img).GetWidth(); x++)
 Convenience macro to sweep an image. More...
 

Typedefs

using crn::SImage = std::shared_ptr< ImageBase >
 
using crn::SCImage = std::shared_ptr< const ImageBase >
 
using crn::WImage = std::weak_ptr< ImageBase >
 
using crn::WCImage = std::weak_ptr< const ImageBase >
 
using crn::UImage = std::unique_ptr< ImageBase >
 
using crn::UCImage = std::unique_ptr< const ImageBase >
 

Functions

UImage crn::NewImageFromFile (const Path &fname)
 Loads an image from a file. More...
 
BoolNotBoolDummy crn::operator+ (const BoolNotBoolDummy &, const BoolNotBoolDummy &)
 
BoolNotBoolDummy crn::operator- (const BoolNotBoolDummy &, const BoolNotBoolDummy &)
 
BoolNotBoolDummy crn::operator* (const BoolNotBoolDummy &, const BoolNotBoolDummy &)
 
BoolNotBoolDummy crn::operator/ (const BoolNotBoolDummy &, const BoolNotBoolDummy &)
 
template<typename T >
bool crn::IsBitonal (const Image< T > &img)
 Is the image binary (black & white)? More...
 
template<typename T , typename CMP = std::less<T>>
std::pair< T, T > crn::MinMax (const Image< T > &img, CMP cmp=CMP{})
 Returns min and max pixel values. More...
 
template<typename T >
Rect crn::AutoCrop (const Image< T > &img, const T &bgval)
 Estimates the ideal crop for the image. More...
 
template<typename T >
Image< T > crn::MakeAutoCrop (const Image< T > &img, const T &bgval)
 Creates a new image as the ideal crop for the image. More...
 
template<typename T , typename Y >
Point2DInt crn::CrossCorrelation (const Image< T > &img1, const Image< Y > &img2, T fill1=T(0), Y fill2=Y(0))
 Best match between two images. More...
 
template<typename IMG , typename T >
IMG crn::Downgrade (const Image< T > &img)
 Converts the image to a type that has a smaller pixel range. More...
 
template<typename T >
SummedAreaTable< SumType< T > > crn::MakeSummedAreaTable (const Image< T > &img)
 Creates a summed area table of the image. More...
 
template<typename T >
Image< T > crn::MakeRotation (const Image< T > &img, const Angle< Degree > &angle, const T &bgColor)
 Creates a rotated version of the image. More...
 
template<typename T >
Image< T > crn::Make90Rotation (const Image< T > &img)
 Creates a rotated version of the image. More...
 
template<typename T >
Image< T > crn::Make180Rotation (const Image< T > &img)
 Creates a rotated version of the image. More...
 
template<typename T >
Image< T > crn::Make270Rotation (const Image< T > &img)
 Creates a rotated version of the image. More...
 
template<typename T >
auto crn::Size (const Image< T > &img) noexcept(noexcept(img.Size())) -> decltype(img.Size())
 
template<typename T1 , typename T2 >
crn::Image< crn::SumType
< typename std::common_type
< T1, T2 >::type > > 
operator+ (const crn::Image< T1 > &i1, const crn::Image< T2 > &i2)
 
template<typename T1 , typename T2 >
crn::Image< crn::DiffType
< typename std::common_type
< T1, T2 >::type > > 
operator- (const crn::Image< T1 > &i1, const crn::Image< T2 > &i2)
 
template<typename T1 , typename T2 >
crn::Image< crn::SumType
< typename std::common_type
< T1, T2 >::type > > 
operator* (const crn::Image< T1 > &i1, const crn::Image< T2 > &i2)
 
template<typename T >
crn::Image< crn::SumType
< typename std::common_type< T,
double >::type > > 
operator* (double d, const crn::Image< T > &i)
 
template<typename T >
crn::Image< crn::SumType
< typename std::common_type< T,
double >::type > > 
operator* (const crn::Image< T > &i, double d)
 
template<typename T1 , typename T2 >
crn::Image< crn::SumType
< typename std::common_type
< T1, T2 >::type > > 
operator/ (const crn::Image< T1 > &i1, const crn::Image< T2 > &i2)
 
template<typename T >
cv::Mat crn::WrapCVMat (crn::Image< T > &img)
 Wraps an image to an OpenCV matrix. More...
 

Detailed Description

Macro Definition Documentation

#define FOREACHPIXEL (   x,
  y,
  img 
)    for (size_t y = 0; y < (img).GetHeight(); y++) for (size_t x = 0; x < (img).GetWidth(); x++)

Convenience macro to sweep an image.

Definition at line 37 of file CRNImage.h.

Typedef Documentation

using crn::SCImage = typedef std::shared_ptr<const ImageBase>

Definition at line 102 of file CRNImage.h.

using crn::SImage = typedef std::shared_ptr<ImageBase>

Definition at line 101 of file CRNImage.h.

using crn::UCImage = typedef std::unique_ptr<const ImageBase>

Definition at line 106 of file CRNImage.h.

using crn::UImage = typedef std::unique_ptr<ImageBase>

Definition at line 105 of file CRNImage.h.

using crn::WCImage = typedef std::weak_ptr<const ImageBase>

Definition at line 104 of file CRNImage.h.

using crn::WImage = typedef std::weak_ptr<ImageBase>

Definition at line 103 of file CRNImage.h.

Function Documentation

template<typename T >
Rect crn::AutoCrop ( const Image< T > &  img,
const T &  bgval 
)

Estimates the ideal crop for the image.

Estimates the ideal crop for the image

Parameters
[in]imgan image
[in]bgvalthe color value of the background
Returns
a rectangle that removes background flat border

Definition at line 1459 of file CRNImage.hpp.

template<typename T , typename Y >
Point2DInt crn::CrossCorrelation ( const Image< T > &  img1,
const Image< Y > &  img2,
fill1,
fill2 
)

Best match between two images.

Best match between two images

Warning
Uses FFT, the memory consumption might be huge!
Parameters
[in]img1first image
[in]img2other image
[in]fill1the fill color for the first image (to grow to power of 2 dimensions)
[in]fill2the fill color for the second image (to grow to power of 2 dimensions)
Returns
the best position so that sum(difference(first[x, y] - second[x + p.X, y + p.Y])) is minimal

Definition at line 1550 of file CRNImage.hpp.

template<typename IMG , typename T >
IMG crn::Downgrade ( const Image< T > &  img)

Converts the image to a type that has a smaller pixel range.

Converts the image to a type that has a smaller pixel range

Parameters
[in]imgthe source image
Returns
a new image

Definition at line 364 of file CRNImage.h.

template<typename T >
bool crn::IsBitonal ( const Image< T > &  img)

Is the image binary (black & white)?

Is the image binary (black & white)?

Parameters
[in]imgan image
Returns
true if the image contains one or two values only, false else

Definition at line 1431 of file CRNImage.hpp.

template<typename T >
Image< T > crn::Make180Rotation ( const Image< T > &  img)

Creates a rotated version of the image.

Creates a rotated version of the image

Parameters
[in]imgthe image to rotate
Returns
a new image

Definition at line 1869 of file CRNImage.hpp.

template<typename T >
Image< T > crn::Make270Rotation ( const Image< T > &  img)

Creates a rotated version of the image.

Creates a rotated version of the image

Parameters
[in]imgthe image to rotate
Returns
a new image

Definition at line 1882 of file CRNImage.hpp.

template<typename T >
Image< T > crn::Make90Rotation ( const Image< T > &  img)

Creates a rotated version of the image.

Creates a rotated version of the image

Parameters
[in]imgthe image to rotate
Returns
a new image

Definition at line 1857 of file CRNImage.hpp.

template<typename T >
Image< T > crn::MakeAutoCrop ( const Image< T > &  img,
const T &  bgval 
)

Creates a new image as the ideal crop for the image.

Creates a new image as the ideal crop for the image

Parameters
[in]imgan image
[in]bgvalthe color value of the background
Returns
a new image

Definition at line 1535 of file CRNImage.hpp.

template<typename T >
Image< T > crn::MakeRotation ( const Image< T > &  img,
const Angle< Degree > &  angle,
const T &  bgColor 
)

Creates a rotated version of the image.

Creates a rotated version of the image

Parameters
[in]imgthe image to rotate
[in]anglethe rotation angle
[in]bgColorthe fill color
Returns
a new image

Definition at line 1813 of file CRNImage.hpp.

template<typename T >
SummedAreaTable< SumType< T > > crn::MakeSummedAreaTable ( const Image< T > &  img)

Creates a summed area table of the image.

Returns
The summed area table of the image

Definition at line 1613 of file CRNImage.hpp.

template<typename T , typename CMP = std::less<T>>
std::pair< T, T > crn::MinMax ( const Image< T > &  img,
CMP  cmp 
)

Returns min and max pixel values.

Parameters
[in]imgan image
Returns
min and max pixel values

Definition at line 1447 of file CRNImage.hpp.

UImage crn::NewImageFromFile ( const Path fname)

Loads an image from a file.

Exceptions
ExceptionInvalidArgumentnull file name
ExceptionIOno decoder found
Parameters
[in]fnamefull path to the image file
Returns
a pointer on an image

Definition at line 609 of file CRNImage.cpp.

BoolNotBoolDummy crn::operator* ( const BoolNotBoolDummy &  ,
const BoolNotBoolDummy &   
)
inline

Definition at line 125 of file CRNImage.h.

template<typename T1 , typename T2 >
crn::Image<crn::SumType<typename std::common_type<T1, T2>::type> > operator* ( const crn::Image< T1 > &  i1,
const crn::Image< T2 > &  i2 
)

Definition at line 1385 of file CRNImage.hpp.

template<typename T >
crn::Image<crn::SumType<typename std::common_type<T, double>::type> > operator* ( double  d,
const crn::Image< T > &  i 
)

Definition at line 1396 of file CRNImage.hpp.

template<typename T >
crn::Image<crn::SumType<typename std::common_type<T, double>::type> > operator* ( const crn::Image< T > &  i,
double  d 
)

Definition at line 1405 of file CRNImage.hpp.

BoolNotBoolDummy crn::operator+ ( const BoolNotBoolDummy &  ,
const BoolNotBoolDummy &   
)
inline

Definition at line 123 of file CRNImage.h.

template<typename T1 , typename T2 >
crn::Image<crn::SumType<typename std::common_type<T1, T2>::type> > operator+ ( const crn::Image< T1 > &  i1,
const crn::Image< T2 > &  i2 
)

Definition at line 1363 of file CRNImage.hpp.

BoolNotBoolDummy crn::operator- ( const BoolNotBoolDummy &  ,
const BoolNotBoolDummy &   
)
inline

Definition at line 124 of file CRNImage.h.

template<typename T1 , typename T2 >
crn::Image<crn::DiffType<typename std::common_type<T1, T2>::type> > operator- ( const crn::Image< T1 > &  i1,
const crn::Image< T2 > &  i2 
)

Definition at line 1374 of file CRNImage.hpp.

BoolNotBoolDummy crn::operator/ ( const BoolNotBoolDummy &  ,
const BoolNotBoolDummy &   
)
inline

Definition at line 126 of file CRNImage.h.

template<typename T1 , typename T2 >
crn::Image<crn::SumType<typename std::common_type<T1, T2>::type> > operator/ ( const crn::Image< T1 > &  i1,
const crn::Image< T2 > &  i2 
)

Definition at line 1410 of file CRNImage.hpp.

template<typename T >
auto crn::Size ( const Image< T > &  img) -> decltype(img.Size())
inlinenoexcept

Definition at line 335 of file CRNImage.h.

template<typename T >
cv::Mat crn::WrapCVMat ( crn::Image< T > &  img)

Wraps an image to an OpenCV matrix.

Wraps an image to an OpenCV matrix. The returned cv::Mat uses the same memory as the crn::Image. In other words, any modification made to the cv::Mat is immediately passed on the crn::Image and vice-versa.

Definition at line 52 of file CRNCV.h.