Build pyramids of vimt_image_2d_of<vxl_byte> at any scale step. More...
#include <vimt_scale_pyramid_builder_2d.h>
Public Member Functions | |
void | set_min_size (unsigned X, unsigned Y) |
Set the minimum size of the top layer of the pyramid. | |
virtual vimt_image_pyramid * | new_image_pyramid () const |
Create new (empty) pyramid on heap. | |
virtual void | set_max_levels (int max_l) |
Define maximum number of levels to build. | |
virtual int | max_levels () const |
Get the current maximum number levels allowed. | |
virtual void | build (vimt_image_pyramid &im_pyr, const vimt_image &im) const |
Build pyramid. | |
vimt_scale_pyramid_builder_2d () | |
Dflt ctor. | |
vimt_scale_pyramid_builder_2d (double scale_step) | |
Construct with given scale_step. | |
~vimt_scale_pyramid_builder_2d () | |
Destructor. | |
virtual double | scale_step () const |
get the current scale step;. | |
void | set_scale_step (double scale_step) |
Set the Scale step. | |
void | scale_reduce (vimt_image_2d_of< T > &dest_im, vimt_image_2d_of< T >const &src_im) const |
Smooth and subsample src_im to produce dest_im. | |
virtual void | extend (vimt_image_pyramid &image_pyr) const |
Extend pyramid. | |
void | scale_reduce (T *dest_im, vcl_ptrdiff_t dest_ystep, const T *src_im, int src_nx, int src_ny, int dest_nx, int dest_ny, vcl_ptrdiff_t src_istep, vcl_ptrdiff_t src_jstep) const |
Smooth and subsample src_im to produce dest_im. | |
vimt_image_pyramid_builder * | clone () const |
Create a copy on the heap and return base class pointer. | |
short | version_no () const |
Version number for I/O. | |
virtual vcl_string | is_a () const |
Name of the class. | |
virtual bool | is_class (vcl_string const &s) const |
Does the name of the class match the argument?. | |
virtual void | print_summary (vcl_ostream &) const |
Print class to os. | |
virtual void | b_write (vsl_b_ostream &bfs) const |
Save class to binary file stream. | |
virtual void | b_read (vsl_b_istream &bfs) |
Load class from binary file stream. | |
Private Member Functions | |
void | checkPyr (vimt_image_pyramid &im_pyr, int n_levels) const |
Checks pyramid has at least n levels of correct type. | |
void | emptyPyr (vimt_image_pyramid &im_pyr) const |
Deletes all data in im_pyr. | |
Private Attributes | |
unsigned | min_x_size_ |
Minimum size in X direction of top layer of pyramid. | |
unsigned | min_y_size_ |
Minimum size in Y direction of top layer of pyramid. | |
unsigned | max_levels_ |
Maximum levels. | |
double | scale_step_ |
The current scale step between pyramid levels. |
Build pyramids of vimt_image_2d_of<vxl_byte> at any scale step.
Definition at line 15 of file vimt_scale_pyramid_builder_2d.h.
vimt_scale_pyramid_builder_2d< T >::vimt_scale_pyramid_builder_2d | ( | ) |
Dflt ctor.
Definition at line 26 of file vimt_scale_pyramid_builder_2d.txx.
vimt_scale_pyramid_builder_2d< T >::vimt_scale_pyramid_builder_2d | ( | double | scale_step | ) |
Construct with given scale_step.
Definition at line 35 of file vimt_scale_pyramid_builder_2d.txx.
vimt_scale_pyramid_builder_2d< T >::~vimt_scale_pyramid_builder_2d | ( | ) |
Destructor.
Definition at line 43 of file vimt_scale_pyramid_builder_2d.txx.
void vimt_scale_pyramid_builder_2d< T >::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Implements vimt_image_pyramid_builder.
Definition at line 382 of file vimt_scale_pyramid_builder_2d.txx.
void vimt_scale_pyramid_builder_2d< T >::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Implements vimt_image_pyramid_builder.
Definition at line 373 of file vimt_scale_pyramid_builder_2d.txx.
void vimt_scale_pyramid_builder_2d< T >::build | ( | vimt_image_pyramid & | im_pyr, |
const vimt_image & | im | ||
) | const [virtual] |
Build pyramid.
Implements vimt_image_pyramid_builder.
Definition at line 194 of file vimt_scale_pyramid_builder_2d.txx.
void vimt_scale_pyramid_builder_2d< T >::checkPyr | ( | vimt_image_pyramid & | im_pyr, |
int | n_levels | ||
) | const [private] |
Checks pyramid has at least n levels of correct type.
Checks pyramid has at least n levels.
Definition at line 169 of file vimt_scale_pyramid_builder_2d.txx.
vimt_image_pyramid_builder * vimt_scale_pyramid_builder_2d< T >::clone | ( | ) | const [virtual] |
Create a copy on the heap and return base class pointer.
Implements vimt_image_pyramid_builder.
Definition at line 357 of file vimt_scale_pyramid_builder_2d.txx.
void vimt_scale_pyramid_builder_2d< T >::emptyPyr | ( | vimt_image_pyramid & | im_pyr | ) | const [private] |
Deletes all data in im_pyr.
Definition at line 160 of file vimt_scale_pyramid_builder_2d.txx.
void vimt_scale_pyramid_builder_2d< T >::extend | ( | vimt_image_pyramid & | image_pyr | ) | const [virtual] |
Extend pyramid.
The first layer of the pyramid must already be set.
Implements vimt_image_pyramid_builder.
Definition at line 255 of file vimt_scale_pyramid_builder_2d.txx.
virtual vcl_string vimt_scale_pyramid_builder_2d< T >::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from vimt_image_pyramid_builder.
bool vimt_scale_pyramid_builder_2d< T >::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Does the name of the class match the argument?.
Reimplemented from vimt_image_pyramid_builder.
Definition at line 341 of file vimt_scale_pyramid_builder_2d.txx.
int vimt_scale_pyramid_builder_2d< T >::max_levels | ( | ) | const [virtual] |
Get the current maximum number levels allowed.
Implements vimt_image_pyramid_builder.
Definition at line 313 of file vimt_scale_pyramid_builder_2d.txx.
vimt_image_pyramid * vimt_scale_pyramid_builder_2d< T >::new_image_pyramid | ( | ) | const [virtual] |
Create new (empty) pyramid on heap.
Caller responsible for its deletion
Implements vimt_image_pyramid_builder.
Definition at line 323 of file vimt_scale_pyramid_builder_2d.txx.
void vimt_scale_pyramid_builder_2d< T >::print_summary | ( | vcl_ostream & | ) | const [virtual] |
Print class to os.
Implements vimt_image_pyramid_builder.
Definition at line 365 of file vimt_scale_pyramid_builder_2d.txx.
void vimt_scale_pyramid_builder_2d< T >::scale_reduce | ( | vimt_image_2d_of< T > & | dest_im, |
vimt_image_2d_of< T >const & | src_im | ||
) | const |
Smooth and subsample src_im to produce dest_im.
Applies an appropriate filter in x and y, then sub-samples at the chosen scaleStep;
Definition at line 48 of file vimt_scale_pyramid_builder_2d.txx.
void vimt_scale_pyramid_builder_2d< T >::scale_reduce | ( | T * | dest_im, |
vcl_ptrdiff_t | dest_jstep, | ||
const T * | src_im, | ||
int | src_ni, | ||
int | src_nj, | ||
int | dest_ni, | ||
int | dest_nj, | ||
vcl_ptrdiff_t | src_istep, | ||
vcl_ptrdiff_t | src_jstep | ||
) | const |
Smooth and subsample src_im to produce dest_im.
Applies 5 element FIR filter in x and y, then samples Assumes dest_im has sufficient data allocated
Applies 5 pin filter in x and y, then samples every other pixel. Assumes dest_im has sufficient data allocated
Definition at line 123 of file vimt_scale_pyramid_builder_2d.txx.
virtual double vimt_scale_pyramid_builder_2d< T >::scale_step | ( | ) | const [inline, virtual] |
get the current scale step;.
Implements vimt_image_pyramid_builder.
Definition at line 67 of file vimt_scale_pyramid_builder_2d.h.
void vimt_scale_pyramid_builder_2d< T >::set_max_levels | ( | int | max_l | ) | [virtual] |
Define maximum number of levels to build.
Limits levels built in subsequent calls to build() Useful efficiency measure. As build() only takes a shallow copy of the original image, using max_l=1 avoids any copying or smoothing.
Limits levels built in subsequent calls to build()
Implements vimt_image_pyramid_builder.
Definition at line 300 of file vimt_scale_pyramid_builder_2d.txx.
void vimt_scale_pyramid_builder_2d< T >::set_min_size | ( | unsigned | X, |
unsigned | Y | ||
) | [inline] |
Set the minimum size of the top layer of the pyramid.
Definition at line 38 of file vimt_scale_pyramid_builder_2d.h.
void vimt_scale_pyramid_builder_2d< T >::set_scale_step | ( | double | scale_step | ) |
Set the Scale step.
Definition at line 150 of file vimt_scale_pyramid_builder_2d.txx.
short vimt_scale_pyramid_builder_2d< T >::version_no | ( | ) | const |
Version number for I/O.
Reimplemented from vimt_image_pyramid_builder.
Definition at line 349 of file vimt_scale_pyramid_builder_2d.txx.
unsigned vimt_scale_pyramid_builder_2d< T >::max_levels_ [private] |
Maximum levels.
Definition at line 24 of file vimt_scale_pyramid_builder_2d.h.
unsigned vimt_scale_pyramid_builder_2d< T >::min_x_size_ [private] |
Minimum size in X direction of top layer of pyramid.
Definition at line 18 of file vimt_scale_pyramid_builder_2d.h.
unsigned vimt_scale_pyramid_builder_2d< T >::min_y_size_ [private] |
Minimum size in Y direction of top layer of pyramid.
Definition at line 21 of file vimt_scale_pyramid_builder_2d.h.
double vimt_scale_pyramid_builder_2d< T >::scale_step_ [private] |
The current scale step between pyramid levels.
Definition at line 33 of file vimt_scale_pyramid_builder_2d.h.