Main MRPT website > C++ reference for MRPT 1.9.9
List of all members | Public Member Functions | Public Attributes
mrpt::vision::CImagePyramid Class Reference

Detailed Description

Holds and builds a pyramid of images: starting with an image at full resolution (octave=1), it builds a number of half-resolution images: octave=2 at 1/2 , octave=3 at 1/2^2, octave=N at 1/2^(N-1).

Color (RGB) or grayscale pyramids can be built from color input images; only grayscale pyramids can be built from grayscale images.

The algorithm to halve the images can be either a 1:2 decimation or a smooth filter (arithmetic mean of every 4 pixels).

Pyramids are built by invoking the method buildPyramid() or buildPyramidFast()

Example of usage:

CImage img = ...
pyr.buildPyramid(
img,
4, // num. of octaves
true // smooth
);
pyr.images[0].saveToFile("pyr0.jpg");
pyr.images[1].saveToFile("pyr1.jpg");
...
Note
Both converting to grayscale and building the octave images have SSE2-optimized implementations (if available).
See also
mrpt::img::CImage

Definition at line 57 of file CImagePyramid.h.

#include <mrpt/vision/CImagePyramid.h>

Public Member Functions

 CImagePyramid ()
 Default constructor, does nothing. More...
 
 ~CImagePyramid ()
 Destructor, frees the stored images. More...
 
void buildPyramid (const mrpt::img::CImage &img, const size_t nOctaves, const bool smooth_halves=true, const bool convert_grayscale=false)
 Fills the vector images with the different octaves built from the input image. More...
 
void buildPyramidFast (mrpt::img::CImage &img, const size_t nOctaves, const bool smooth_halves=true, const bool convert_grayscale=false)
 Exactly like buildPyramid(), but if the input image has not to be converted from RGB to grayscale, the image data buffer is reutilized for the 1st octave in images[0], emptying the input image. More...
 

Public Attributes

std::vector< mrpt::img::CImageimages
 The individual images: More...
 

Constructor & Destructor Documentation

◆ CImagePyramid()

CImagePyramid::CImagePyramid ( )

Default constructor, does nothing.

Definition at line 17 of file CImagePyramid.cpp.

◆ ~CImagePyramid()

CImagePyramid::~CImagePyramid ( )

Destructor, frees the stored images.

Definition at line 18 of file CImagePyramid.cpp.

Member Function Documentation

◆ buildPyramid()

void CImagePyramid::buildPyramid ( const mrpt::img::CImage img,
const size_t  nOctaves,
const bool  smooth_halves = true,
const bool  convert_grayscale = false 
)

Fills the vector images with the different octaves built from the input image.

Parameters
[in]imgThe input image. Can be either color or grayscale.
[in]nOctavesNumber of octaves to build. 1 means just the original image, 2 means the original plus the 1/2 image, etc.
[in]smooth_halvesIf true, use an arithmetic mean of every 2x2 pixel block when downsampling.
[in]convert_grayscaleIf true, the pyramid is built in grayscale even for color input images.
See also
buildPyramidFast

Definition at line 61 of file CImagePyramid.cpp.

◆ buildPyramidFast()

void CImagePyramid::buildPyramidFast ( mrpt::img::CImage img,
const size_t  nOctaves,
const bool  smooth_halves = true,
const bool  convert_grayscale = false 
)

Exactly like buildPyramid(), but if the input image has not to be converted from RGB to grayscale, the image data buffer is reutilized for the 1st octave in images[0], emptying the input image.

See also
buildPyramid

Definition at line 70 of file CImagePyramid.cpp.

Member Data Documentation

◆ images

std::vector<mrpt::img::CImage> mrpt::vision::CImagePyramid::images

The individual images:

  • images[0]: 1st octave (full-size)
  • images[1]: 2nd octave (1/2 size)
  • images[2]: 3rd octave (1/4 size)

Definition at line 94 of file CImagePyramid.h.

mrpt::vision::CImagePyramid::CImagePyramid
CImagePyramid()
Default constructor, does nothing.
Definition: CImagePyramid.cpp:17
mrpt::utils::CImage
mrpt::img::CImage CImage
Definition: utils/CImage.h:7
mrpt::img::CImage::saveToFile
bool saveToFile(const std::string &fileName, int jpeg_quality=95) const
Save the image to a file, whose format is determined from the extension (internally uses OpenCV).
Definition: CImage.cpp:296
img
GLint GLvoid * img
Definition: glext.h:3763



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST