Represent 2D image of type T together with a transform. More...
#include <vimt_image_2d_of.h>
Public Member Functions | |
vimt_image_2d_of () | |
Default constructor. | |
vimt_image_2d_of (unsigned ni, unsigned nj, unsigned np=1, const vimt_transform_2d &w2i=vimt_transform_2d()) | |
Construct an image of size (ni, nj, np) with optional world_to_image transform. | |
vimt_image_2d_of (const vil_image_view< T > &view, const vimt_transform_2d &w2i=vimt_transform_2d()) | |
Construct from a view and optional world-to-image transform (takes copies of both). | |
virtual | ~vimt_image_2d_of () |
Destructor. | |
virtual const vil_image_view_base & | image_base () const |
Baseclass view of image. | |
vil_image_view< T > & | image () |
Image view. | |
const vil_image_view< T > & | image () const |
Image view. | |
bool | operator== (const vimt_image_2d_of< T > &) const |
True if transforms are equal, and they share same image data. | |
void | set_valid_region (int x0, unsigned nx, int y0, unsigned ny) |
Define valid data region (including transform). | |
unsigned | n_planes () const |
Get the number of planes in the image. | |
void | deep_copy (const vimt_image_2d_of &image) |
Take a deep copy of image (copy data, not just pointers). | |
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 vimt_image * | clone () const |
Create a copy on the heap and return base class pointer. | |
virtual vimt_image * | deep_clone () const |
Create a deep copy on the heap and return base class pointer. | |
virtual void | print_summary (vcl_ostream &os) const |
Print class to os. | |
virtual void | print_all (vcl_ostream &os) const |
print all data to os (rounds output to int). | |
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. | |
virtual unsigned | n_dims () const |
Return dimensionality of image. | |
virtual vcl_vector< unsigned > | image_size () const |
Return vector indicating size of image in pixels. | |
virtual vcl_vector< double > | pixel_size () const |
Return 2 element vector indicating the size of a pixel. | |
virtual void | world_bounds (vcl_vector< double > &b_lo, vcl_vector< double > &b_hi) const |
Return vectors defining bounding box containing image in world co-ords. | |
const vimt_transform_2d & | world2im () const |
Current world-to-image transformation. | |
vimt_transform_2d & | world2im () |
Current world-to-image transformation. | |
void | set_world2im (const vimt_transform_2d &w2i) |
Set world-to-image transformation. | |
bool | operator== (const vimt_image &) const |
Shallow equality. | |
Protected Attributes | |
vimt_transform_2d | world2im_ |
Private Member Functions | |
bool | equals (const vimt_image &) const |
Shallow equality tester. | |
Private Attributes | |
vil_image_view< T > | image_ |
Related Functions | |
(Note that these are not member functions.) | |
template<class srcT , class destT , class kernelT , class accumT > | |
void | vimt_normalised_correlation_2d (const vimt_image_2d_of< srcT > &src_im, vimt_image_2d_of< destT > &dest_im, const vil_image_view< kernelT > &kernel, vgl_point_2d< double > kernel_ref_pt, accumT ac) |
Evaluate dot product between kernel and (normalised) src_im. | |
template<class imType , class vecType > | |
void | vimt_sample_grid_bicub (vnl_vector< vecType > &vec, const vimt_image_2d_of< imType > &image, const vgl_point_2d< double > &p, const vgl_vector_2d< double > &u, const vgl_vector_2d< double > &v, int n1, int n2) |
Sample grid from image, using bicubic interpolation. | |
template<class imType , class vecType > | |
void | vimt_sample_grid_bilin (vnl_vector< vecType > &vec, const vimt_image_2d_of< imType > &image, const vgl_point_2d< double > &p, const vgl_vector_2d< double > &u, const vgl_vector_2d< double > &v, int n1, int n2) |
Sample grid from image, using bilinear interpolation. | |
template<class imType , class vecType > | |
void | vimt_sample_grid_bilin_edgena (vnl_vector< vecType > &vec, const vimt_image_2d_of< imType > &image, const vgl_point_2d< double > &p, const vgl_vector_2d< double > &u, const vgl_vector_2d< double > &v, int n1, int n2) |
Sample grid from image, using bilinear interpolation. |
Represent 2D image of type T together with a transform.
Each plane is ni() x nj() Ts, with the (x,y) element of the i'th plane accessible using im.plane(i)[x*im.istep() + y*im.jstep()]
Definition at line 17 of file vimt_image_2d_of.h.
vimt_image_2d_of< T >::vimt_image_2d_of | ( | ) | [inline] |
Default constructor.
Creates an empty one-plane image.
Definition at line 29 of file vimt_image_2d_of.h.
vimt_image_2d_of< T >::vimt_image_2d_of | ( | unsigned | ni, |
unsigned | nj, | ||
unsigned | np = 1 , |
||
const vimt_transform_2d & | w2i = vimt_transform_2d() |
||
) | [inline] |
Construct an image of size (ni, nj, np) with optional world_to_image transform.
Definition at line 33 of file vimt_image_2d_of.h.
vimt_image_2d_of< T >::vimt_image_2d_of | ( | const vil_image_view< T > & | view, |
const vimt_transform_2d & | w2i = vimt_transform_2d() |
||
) | [inline, explicit] |
Construct from a view and optional world-to-image transform (takes copies of both).
Definition at line 39 of file vimt_image_2d_of.h.
virtual vimt_image_2d_of< T >::~vimt_image_2d_of | ( | ) | [inline, virtual] |
Destructor.
Definition at line 45 of file vimt_image_2d_of.h.
void vimt_image_2d_of< T >::b_read | ( | vsl_b_istream & | bfs | ) | [virtual] |
Load class from binary file stream.
Implements vimt_image.
Definition at line 101 of file vimt_image_2d_of.txx.
void vimt_image_2d_of< T >::b_write | ( | vsl_b_ostream & | bfs | ) | const [virtual] |
Save class to binary file stream.
Implements vimt_image.
Definition at line 91 of file vimt_image_2d_of.txx.
virtual vimt_image* vimt_image_2d_of< T >::clone | ( | ) | const [inline, virtual] |
Create a copy on the heap and return base class pointer.
Note that this will make a shallow copy of any contained images
Implements vimt_image.
Definition at line 86 of file vimt_image_2d_of.h.
vimt_image * vimt_image_2d_of< T >::deep_clone | ( | ) | const [virtual] |
Create a deep copy on the heap and return base class pointer.
This will make a deep copy of any contained images
Implements vimt_image.
Definition at line 61 of file vimt_image_2d_of.txx.
void vimt_image_2d_of< T >::deep_copy | ( | const vimt_image_2d_of< T > & | image | ) |
Take a deep copy of image (copy data, not just pointers).
Perform deep copy of src into this image.
Definition at line 20 of file vimt_image_2d_of.txx.
bool vimt_image_2d_of< T >::equals | ( | const vimt_image & | im | ) | const [private, virtual] |
Shallow equality tester.
The parameter must be identical type to this.
Implements vimt_image.
Definition at line 29 of file vimt_image_2d_of.txx.
vil_image_view<T>& vimt_image_2d_of< T >::image | ( | ) | [inline] |
Image view.
Definition at line 51 of file vimt_image_2d_of.h.
const vil_image_view<T>& vimt_image_2d_of< T >::image | ( | ) | const [inline] |
Image view.
Definition at line 54 of file vimt_image_2d_of.h.
virtual const vil_image_view_base& vimt_image_2d_of< T >::image_base | ( | ) | const [inline, virtual] |
Baseclass view of image.
Implements vimt_image_2d.
Definition at line 48 of file vimt_image_2d_of.h.
vcl_vector< unsigned > vimt_image_2d::image_size | ( | ) | const [virtual, inherited] |
Return vector indicating size of image in pixels.
2D image is v[0] x v[1] Somewhat inefficient: Only use when you absolutely have to. Usually one only needs to know the size once one knows the exact type.
2D image is v[0] x v[1], 3D image is v[0] x v[1] x v[2] Somewhat inefficient: Only use when you have to
Implements vimt_image.
Definition at line 13 of file vimt_image_2d.cxx.
virtual vcl_string vimt_image_2d_of< T >::is_a | ( | ) | const [virtual] |
Name of the class.
Reimplemented from vimt_image_2d.
bool vimt_image_2d_of< T >::is_class | ( | vcl_string const & | s | ) | const [virtual] |
Does the name of the class match the argument?.
Reimplemented from vimt_image_2d.
Definition at line 46 of file vimt_image_2d_of.txx.
virtual unsigned vimt_image_2d::n_dims | ( | ) | const [inline, virtual, inherited] |
Return dimensionality of image.
Implements vimt_image.
Definition at line 30 of file vimt_image_2d.h.
unsigned vimt_image_2d_of< T >::n_planes | ( | ) | const [inline, virtual] |
Get the number of planes in the image.
Implements vimt_image.
Definition at line 70 of file vimt_image_2d_of.h.
bool vimt_image_2d_of< T >::operator== | ( | const vimt_image_2d_of< T > & | other | ) | const |
True if transforms are equal, and they share same image data.
True if transforms, etc. are equal, and they share same image data.
This does not do a deep equality on image data. If the images point to different image data objects that contain identical images, then the result will still be false.
Definition at line 126 of file vimt_image_2d_of.txx.
bool vimt_image::operator== | ( | const vimt_image & | im | ) | const [inherited] |
Shallow equality.
tests if the two images are the same type, have equal transforms, and point to the same image data with equal step sizes, etc.
Definition at line 27 of file vimt_image.cxx.
vcl_vector< double > vimt_image_2d::pixel_size | ( | ) | const [virtual, inherited] |
Return 2 element vector indicating the size of a pixel.
Somewhat inefficient: Only use when you absolutely have to. Usually one only needs to know the size once one knows the exact type.
Implements vimt_image.
Definition at line 23 of file vimt_image_2d.cxx.
void vimt_image_2d_of< T >::print_all | ( | vcl_ostream & | os | ) | const [virtual] |
print all data to os (rounds output to int).
print all data to os.
Implements vimt_image.
Definition at line 80 of file vimt_image_2d_of.txx.
void vimt_image_2d_of< T >::print_summary | ( | vcl_ostream & | os | ) | const [virtual] |
void vimt_image_2d_of< T >::set_valid_region | ( | int | x0, |
unsigned | nx, | ||
int | y0, | ||
unsigned | ny | ||
) |
Define valid data region (including transform).
Resizes and sets the transformation so that world2im(x,y) is valid for all points in range Specifically, set_valid_region(x0,nx,y0,ny); world2im() translates by (-x0,-y0)
Resizes and sets the transformation so that worldToIm(x,y) is valid for all points in range
Definition at line 39 of file vimt_image_2d_of.txx.
void vimt_image_2d::set_world2im | ( | const vimt_transform_2d & | w2i | ) | [inline, inherited] |
Set world-to-image transformation.
Definition at line 57 of file vimt_image_2d.h.
short vimt_image_2d_of< T >::version_no | ( | ) | const |
Version number for I/O.
Reimplemented from vimt_image.
Definition at line 54 of file vimt_image_2d_of.txx.
const vimt_transform_2d& vimt_image_2d::world2im | ( | ) | const [inline, inherited] |
Current world-to-image transformation.
Definition at line 50 of file vimt_image_2d.h.
vimt_transform_2d& vimt_image_2d::world2im | ( | ) | [inline, inherited] |
Current world-to-image transformation.
Definition at line 53 of file vimt_image_2d.h.
void vimt_image_2d::world_bounds | ( | vcl_vector< double > & | b_lo, |
vcl_vector< double > & | b_hi | ||
) | const [virtual, inherited] |
Return vectors defining bounding box containing image in world co-ords.
Somewhat inefficient: Only use when you absolutely have to. Usually one only needs to know the size once one knows the exact type.
Implements vimt_image.
Definition at line 36 of file vimt_image_2d.cxx.
void vimt_normalised_correlation_2d | ( | const vimt_image_2d_of< srcT > & | src_im, |
vimt_image_2d_of< destT > & | dest_im, | ||
const vil_image_view< kernelT > & | kernel, | ||
vgl_point_2d< double > | kernel_ref_pt, | ||
accumT | ac | ||
) | [related] |
Evaluate dot product between kernel and (normalised) src_im.
Assumes that the kernel has been normalised to have zero mean and unit variance.
Definition at line 18 of file vimt_normalised_correlation_2d.h.
void vimt_sample_grid_bicub | ( | vnl_vector< vecType > & | vec, |
const vimt_image_2d_of< imType > & | image, | ||
const vgl_point_2d< double > & | p0, | ||
const vgl_vector_2d< double > & | u, | ||
const vgl_vector_2d< double > & | v, | ||
int | n1, | ||
int | n2 | ||
) | [related] |
Sample grid from image, using bicubic interpolation.
Grid points are p+i.u+j.v where i=[0..n1-1], j=[0..n2-1] Vector vec is resized to n1*n2*np elements, where np=image.nplanes(). vec[0]..vec[np-1] are the values from point p Samples are taken along direction v first, then along u. Points outside image return zero.
Grid points are p+i.u+j.v where i=[0..n1-1], j=[0..n2-1] Vector vec is resized to n1*n2*np elements, where np=image.nplanes(). vec[0]..vec[np-1] are the values from point p0 Samples are taken along direction v first, then along u. Points outside image return zero.
Definition at line 34 of file vimt_sample_grid_bicub.txx.
void vimt_sample_grid_bilin | ( | vnl_vector< vecType > & | vec, |
const vimt_image_2d_of< imType > & | image, | ||
const vgl_point_2d< double > & | p0, | ||
const vgl_vector_2d< double > & | u, | ||
const vgl_vector_2d< double > & | v, | ||
int | n1, | ||
int | n2 | ||
) | [related] |
Sample grid from image, using bilinear interpolation.
Grid points are p+i.u+j.v where i=[0..n1-1], j=[0..n2-1] Vector vec is resized to n1*n2*np elements, where np=image.nplanes(). vec[0]..vec[np-1] are the values from point p Samples are taken along direction v first, then along u. Points outside image return zero.
Grid points are p+i.u+j.v where i=[0..n1-1], j=[0..n2-1] Vector vec is resized to n1*n2*np elements, where np=image.nplanes(). vec[0]..vec[np-1] are the values from point p0 Samples are taken along direction v first, then along u. Points outside image return zero.
Definition at line 34 of file vimt_sample_grid_bilin.txx.
void vimt_sample_grid_bilin_edgena | ( | vnl_vector< vecType > & | vec, |
const vimt_image_2d_of< imType > & | image, | ||
const vgl_point_2d< double > & | p0, | ||
const vgl_vector_2d< double > & | u, | ||
const vgl_vector_2d< double > & | v, | ||
int | n1, | ||
int | n2 | ||
) | [related] |
Sample grid from image, using bilinear interpolation.
Grid points are p+i.u+j.v where i=[0..n1-1], j=[0..n2-1] Vector vec is resized to n1*n2*np elements, where np=image.nplanes(). vec[0]..vec[np-1] are the values from point p Samples are taken along direction v first, then along u. Points outside image return NA.
Grid points are p+i.u+j.v where i=[0..n1-1], j=[0..n2-1] Vector vec is resized to n1*n2*np elements, where np=image.nplanes(). vec[0]..vec[np-1] are the values from point p0 Samples are taken along direction v first, then along u. Points outside image return NA.
Definition at line 148 of file vimt_sample_grid_bilin.txx.
vil_image_view<T> vimt_image_2d_of< T >::image_ [private] |
Definition at line 19 of file vimt_image_2d_of.h.
vimt_transform_2d vimt_image_2d::world2im_ [protected, inherited] |
Definition at line 18 of file vimt_image_2d.h.