|
<html><head><title>dlib C++ Library - point_transforms_abstract.h</title></head><body bgcolor='white'><pre> |
|
<font color='#009900'>// Copyright (C) 2003 Davis E. King ([email protected]) |
|
</font><font color='#009900'>// License: Boost Software License See LICENSE.txt for the full license. |
|
</font><font color='#0000FF'>#undef</font> DLIB_POINT_TrANSFORMS_ABSTRACT_Hh_ |
|
<font color='#0000FF'>#ifdef</font> DLIB_POINT_TrANSFORMS_ABSTRACT_Hh_ |
|
|
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../matrix/matrix_abstract.h.html'>../matrix/matrix_abstract.h</a>" |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='vector_abstract.h.html'>vector_abstract.h</a>" |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='rectangle_abstract.h.html'>rectangle_abstract.h</a>" |
|
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='drectangle_abstract.h.html'>drectangle_abstract.h</a>" |
|
<font color='#0000FF'>#include</font> <font color='#5555FF'><</font>vector<font color='#5555FF'>></font> |
|
|
|
<font color='#0000FF'>namespace</font> dlib |
|
<b>{</b> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='point_transform_affine'></a>point_transform_affine</b> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This is an object that takes 2D points or vectors and |
|
applies an affine transformation to them. |
|
|
|
THREAD SAFETY |
|
It is safe for multiple threads to make concurrent accesses to this object |
|
without synchronization. |
|
!*/</font> |
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='point_transform_affine'></a>point_transform_affine</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- This object will perform the identity transform. That is, given a point |
|
as input it will return the same point as output. |
|
!*/</font> |
|
|
|
<b><a name='point_transform_affine'></a>point_transform_affine</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> matrix<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font>,<font color='#979000'>2</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> m, |
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> b |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #get_m() == m |
|
- #get_b() == b |
|
- When (*this)(p) is invoked it will return a point P such that: |
|
- P == m*p + b |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>></font> <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- applies the affine transformation defined by this object's constructor |
|
to p and returns the result. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> matrix<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font>,<font color='#979000'>2</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> <b><a name='get_m'></a>get_m</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the transformation matrix used by this object. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> <b><a name='get_b'></a>get_b</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the offset vector used by this object. |
|
!*/</font> |
|
|
|
<b>}</b>; |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='serialize'></a>serialize</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> point_transform_affine<font color='#5555FF'>&</font> item, std::ostream<font color='#5555FF'>&</font> out<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='deserialize'></a>deserialize</b> <font face='Lucida Console'>(</font>point_transform_affine<font color='#5555FF'>&</font> item, std::istream<font color='#5555FF'>&</font> in<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
provides serialization support |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
point_transform_affine <b><a name='operator'></a>operator</b><font color='#5555FF'>*</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> point_transform_affine<font color='#5555FF'>&</font> lhs, |
|
<font color='#0000FF'>const</font> point_transform_affine<font color='#5555FF'>&</font> rhs |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns a transformation TFORM(x) that is equivalent to lhs(rhs(x)). That |
|
is, for all valid x: TFORM(x) == lhs(rhs(x)). |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
point_transform_affine <b><a name='inv'></a>inv</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> point_transform_affine<font color='#5555FF'>&</font> trans |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- If trans is an invertible transformation then this function returns a new |
|
transformation that is the inverse of trans. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>></font> |
|
point_transform_affine <b><a name='find_affine_transform'></a>find_affine_transform</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>dlib::vector<font color='#5555FF'><</font>T,<font color='#979000'>2</font><font color='#5555FF'>></font> <font color='#5555FF'>></font><font color='#5555FF'>&</font> from_points, |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>dlib::vector<font color='#5555FF'><</font>T,<font color='#979000'>2</font><font color='#5555FF'>></font> <font color='#5555FF'>></font><font color='#5555FF'>&</font> to_points |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- from_points.size() == to_points.size() |
|
- from_points.size() >= 3 |
|
ensures |
|
- returns a point_transform_affine object, T, such that for all valid i: |
|
length(T(from_points[i]) - to_points[i]) |
|
is minimized as often as possible. That is, this function finds the affine |
|
transform that maps points in from_points to points in to_points. If no |
|
affine transform exists which performs this mapping exactly then the one |
|
which minimizes the mean squared error is selected. Additionally, if many |
|
equally good transformations exist, then the transformation with the smallest |
|
squared parameters is selected (i.e. if you wrote the transformation as a |
|
matrix then we say we select the transform with minimum Frobenius norm among |
|
all possible solutions). |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>></font> |
|
point_transform_affine <b><a name='find_similarity_transform'></a>find_similarity_transform</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>dlib::vector<font color='#5555FF'><</font>T,<font color='#979000'>2</font><font color='#5555FF'>></font> <font color='#5555FF'>></font><font color='#5555FF'>&</font> from_points, |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>dlib::vector<font color='#5555FF'><</font>T,<font color='#979000'>2</font><font color='#5555FF'>></font> <font color='#5555FF'>></font><font color='#5555FF'>&</font> to_points |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- from_points.size() == to_points.size() |
|
- from_points.size() >= 2 |
|
ensures |
|
- This function is just like find_affine_transform() except it finds the best |
|
similarity transform instead of a full affine transform. This means that it |
|
optimizes over only the space of rotations, scale changes, and translations. |
|
So for example, if you mapped the 3 vertices of a triangle through a |
|
similarity transform then the output would still be the same triangle. |
|
However, the triangle itself may be larger or smaller, rotated, or at a |
|
different location in the coordinate system. This is not the case for a |
|
general affine transform which can stretch points in ways that cause, for |
|
example, an equilateral triangle to turn into an isosceles triangle. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='rectangle_transform'></a>rectangle_transform</b> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This object is just a point_transform_affine wrapped up so that it can |
|
transform rectangle objects. It will take a rectangle and transform it |
|
according to an affine transformation. |
|
|
|
THREAD SAFETY |
|
It is safe for multiple threads to make concurrent accesses to this object |
|
without synchronization. |
|
!*/</font> |
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='rectangle_transform'></a>rectangle_transform</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- This object will perform the identity transform. That is, given a rectangle |
|
as input it will return the same rectangle as output. |
|
!*/</font> |
|
|
|
<b><a name='rectangle_transform'></a>rectangle_transform</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> point_transform_affine<font color='#5555FF'>&</font> tform |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #get_tform() == tform |
|
!*/</font> |
|
|
|
drectangle <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> drectangle<font color='#5555FF'>&</font> r |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Applies the transformation get_tform() to r and returns the resulting |
|
rectangle. If the transformation doesn't have any rotation then the |
|
transformation simply maps the corners of the rectangle according to |
|
get_tform() and returns the exact result. However, since |
|
dlib::drectangle can't represent rotated rectangles, if there is any |
|
rotation in the affine transform we will attempt to produce the most |
|
faithful possible outputs by ensuring the output rectangle has the |
|
correct center point and that its area and aspect ratio match the correct |
|
rotated rectangle's as much as possible. |
|
!*/</font> |
|
|
|
rectangle <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> rectangle<font color='#5555FF'>&</font> r |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns (*this)(drectangle(r)) |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> point_transform_affine<font color='#5555FF'>&</font> <b><a name='get_tform'></a>get_tform</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the affine transformation this object uses to transform rectangles. |
|
!*/</font> |
|
|
|
<b>}</b>; |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='serialize'></a>serialize</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> rectangle_transform<font color='#5555FF'>&</font> item, std::ostream<font color='#5555FF'>&</font> out<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='deserialize'></a>deserialize</b> <font face='Lucida Console'>(</font>rectangle_transform<font color='#5555FF'>&</font> item, std::istream<font color='#5555FF'>&</font> in<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
provides serialization support |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='point_transform_projective'></a>point_transform_projective</b> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This is an object that takes 2D points or vectors and |
|
applies a projective transformation to them. |
|
|
|
THREAD SAFETY |
|
It is safe for multiple threads to make concurrent accesses to this object |
|
without synchronization. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='point_transform_projective'></a>point_transform_projective</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- This object will perform the identity transform. That is, given a point |
|
as input it will return the same point as output. |
|
!*/</font> |
|
|
|
<b><a name='point_transform_projective'></a>point_transform_projective</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> matrix<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>3</font>,<font color='#979000'>3</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> m |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #get_m() == m |
|
!*/</font> |
|
|
|
<b><a name='point_transform_projective'></a>point_transform_projective</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> point_transform_affine<font color='#5555FF'>&</font> tran |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- This object will perform exactly the same transformation as the given |
|
affine transform. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>></font> <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Applies the projective transformation defined by this object's constructor |
|
to p and returns the result. To define this precisely: |
|
- let p_h == the point p in homogeneous coordinates. That is: |
|
- p_h.x() == p.x() |
|
- p_h.y() == p.y() |
|
- p_h.z() == 1 |
|
- let x == get_m()*p_h |
|
- Then this function returns the value x/x.z() |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> matrix<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>3</font>,<font color='#979000'>3</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> <b><a name='get_m'></a>get_m</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the transformation matrix used by this object. |
|
!*/</font> |
|
|
|
<b>}</b>; |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='serialize'></a>serialize</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> point_transform_projective<font color='#5555FF'>&</font> item, std::ostream<font color='#5555FF'>&</font> out<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='deserialize'></a>deserialize</b> <font face='Lucida Console'>(</font>point_transform_projective<font color='#5555FF'>&</font> item, std::istream<font color='#5555FF'>&</font> in<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
provides serialization support |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
point_transform_projective <b><a name='operator'></a>operator</b><font color='#5555FF'>*</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> point_transform_projective<font color='#5555FF'>&</font> lhs, |
|
<font color='#0000FF'>const</font> point_transform_projective<font color='#5555FF'>&</font> rhs |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns a transformation TFORM(x) that is equivalent to lhs(rhs(x)). That |
|
is, for all valid x: TFORM(x) == lhs(rhs(x)). |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
point_transform_projective <b><a name='inv'></a>inv</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> point_transform_projective<font color='#5555FF'>&</font> trans |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- If trans is an invertible transformation then this function returns a new |
|
transformation that is the inverse of trans. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
point_transform_projective <b><a name='find_projective_transform'></a>find_projective_transform</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>></font> <font color='#5555FF'>></font><font color='#5555FF'>&</font> from_points, |
|
<font color='#0000FF'>const</font> std::vector<font color='#5555FF'><</font>dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>></font> <font color='#5555FF'>></font><font color='#5555FF'>&</font> to_points |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- from_points.size() == to_points.size() |
|
- from_points.size() >= 4 |
|
ensures |
|
- returns a point_transform_projective object, T, such that for all valid i: |
|
length(T(from_points[i]) - to_points[i]) |
|
is minimized as often as possible. That is, this function finds the projective |
|
transform that maps points in from_points to points in to_points. If no |
|
projective transform exists which performs this mapping exactly then the one |
|
which minimizes the mean squared error is selected. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='point_transform'></a>point_transform</b> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This is an object that takes 2D points or vectors and |
|
rotates them around the origin by a given angle and then |
|
translates them. |
|
|
|
THREAD SAFETY |
|
It is safe for multiple threads to make concurrent accesses to this object |
|
without synchronization. |
|
!*/</font> |
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='point_transform'></a>point_transform</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- This object will perform the identity transform. That is, given a point |
|
as input it will return the same point as output. |
|
!*/</font> |
|
|
|
<b><a name='point_transform'></a>point_transform</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> <font color='#0000FF'><u>double</u></font><font color='#5555FF'>&</font> angle, |
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> translate |
|
<font face='Lucida Console'>)</font> |
|
<font color='#009900'>/*! |
|
ensures |
|
- When (*this)(p) is invoked it will return a point P such that: |
|
- P is the point p rotated counter-clockwise around the origin |
|
angle radians and then shifted by having translate added to it. |
|
(Note that this is counter clockwise with respect to the normal |
|
coordinate system with positive y going up and positive x going |
|
to the right) |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>></font> |
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font>T,<font color='#979000'>2</font><font color='#5555FF'>></font> <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font>T,<font color='#979000'>2</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- rotates p, then translates it and returns the result. The output |
|
of this function is therefore equal to get_m()*p + get_b(). |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> matrix<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font>,<font color='#979000'>2</font><font color='#5555FF'>></font> <b><a name='get_m'></a>get_m</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the transformation matrix used by this object. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font><font color='#5555FF'>></font> <b><a name='get_b'></a>get_b</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the offset vector used by this object. |
|
!*/</font> |
|
|
|
<b>}</b>; |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='serialize'></a>serialize</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> point_transform<font color='#5555FF'>&</font> item, std::ostream<font color='#5555FF'>&</font> out<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='deserialize'></a>deserialize</b> <font face='Lucida Console'>(</font>point_transform<font color='#5555FF'>&</font> item, std::istream<font color='#5555FF'>&</font> in<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
provides serialization support |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='point_rotator'></a>point_rotator</b> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This is an object that takes 2D points or vectors and |
|
rotates them around the origin by a given angle. |
|
|
|
THREAD SAFETY |
|
It is safe for multiple threads to make concurrent accesses to this object |
|
without synchronization. |
|
!*/</font> |
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='point_rotator'></a>point_rotator</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- This object will perform the identity transform. That is, given a point |
|
as input it will return the same point as output. |
|
!*/</font> |
|
|
|
<b><a name='point_rotator'></a>point_rotator</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> <font color='#0000FF'><u>double</u></font><font color='#5555FF'>&</font> angle |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- When (*this)(p) is invoked it will return a point P such that: |
|
- P is the point p rotated counter-clockwise around the origin |
|
angle radians. |
|
(Note that this is counter clockwise with respect to the normal |
|
coordinate system with positive y going up and positive x going |
|
to the right) |
|
!*/</font> |
|
|
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>></font> |
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font>T,<font color='#979000'>2</font><font color='#5555FF'>></font> <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font>T,<font color='#979000'>2</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- rotates p and returns the result. The output of this function is |
|
therefore equal to get_m()*p. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> matrix<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font>,<font color='#979000'>2</font><font color='#5555FF'>></font> <b><a name='get_m'></a>get_m</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the transformation matrix used by this object. |
|
!*/</font> |
|
<b>}</b>; |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='serialize'></a>serialize</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> point_rotator<font color='#5555FF'>&</font> item, std::ostream<font color='#5555FF'>&</font> out<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='deserialize'></a>deserialize</b> <font face='Lucida Console'>(</font>point_rotator<font color='#5555FF'>&</font> item, std::istream<font color='#5555FF'>&</font> in<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
provides serialization support |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>template</font> <font color='#5555FF'><</font><font color='#0000FF'>typename</font> T<font color='#5555FF'>></font> |
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font>T,<font color='#979000'>2</font><font color='#5555FF'>></font> <b><a name='rotate_point'></a>rotate_point</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font>T,<font color='#979000'>2</font><font color='#5555FF'>></font> center, |
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font>T,<font color='#979000'>2</font><font color='#5555FF'>></font> p, |
|
<font color='#0000FF'><u>double</u></font> angle |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns a point P such that: |
|
- P is the point p rotated counter-clockwise around the given |
|
center point by angle radians. |
|
(Note that this is counter clockwise with respect to the normal |
|
coordinate system with positive y going up and positive x going |
|
to the right) |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
matrix<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>2</font>,<font color='#979000'>2</font><font color='#5555FF'>></font> <b><a name='rotation_matrix'></a>rotation_matrix</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>double</u></font> angle |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns a rotation matrix which rotates points around the origin in a |
|
counter-clockwise direction by angle radians. |
|
(Note that this is counter clockwise with respect to the normal |
|
coordinate system with positive y going up and positive x going |
|
to the right) |
|
Or in other words, this function returns a matrix M such that, given a |
|
point P, M*P gives a point which is P rotated by angle radians around |
|
the origin in a counter-clockwise direction. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='point_transform_affine3d'></a>point_transform_affine3d</b> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This is an object that takes 3D points or vectors and |
|
applies an affine transformation to them. |
|
|
|
THREAD SAFETY |
|
It is safe for multiple threads to make concurrent accesses to this object |
|
without synchronization. |
|
!*/</font> |
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='point_transform_affine3d'></a>point_transform_affine3d</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- This object will perform the identity transform. That is, given a point |
|
as input it will return the same point as output. |
|
!*/</font> |
|
|
|
<b><a name='point_transform_affine3d'></a>point_transform_affine3d</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> matrix<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>3</font>,<font color='#979000'>3</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> m, |
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>3</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> b |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #get_m() == m |
|
- #get_b() == b |
|
- When (*this)(p) is invoked it will return a point P such that: |
|
- P == m*p + b |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>3</font><font color='#5555FF'>></font> <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>3</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- applies the affine transformation defined by this object's constructor |
|
to p and returns the result. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> matrix<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>3</font>,<font color='#979000'>3</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> <b><a name='get_m'></a>get_m</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the transformation matrix used by this object. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>const</font> dlib::vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>3</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> <b><a name='get_b'></a>get_b</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the offset vector used by this object. |
|
!*/</font> |
|
|
|
<b>}</b>; |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='serialize'></a>serialize</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> point_transform_affine3d<font color='#5555FF'>&</font> item, std::ostream<font color='#5555FF'>&</font> out<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='deserialize'></a>deserialize</b> <font face='Lucida Console'>(</font>point_transform_affine3d<font color='#5555FF'>&</font> item, std::istream<font color='#5555FF'>&</font> in<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
provides serialization support |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
point_transform_affine3d <b><a name='operator'></a>operator</b><font color='#5555FF'>*</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> point_transform_affine3d<font color='#5555FF'>&</font> lhs, |
|
<font color='#0000FF'>const</font> point_transform_affine3d<font color='#5555FF'>&</font> rhs |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns a transformation TFORM(x) that is equivalent to lhs(rhs(x)). That |
|
is, for all valid x: TFORM(x) == lhs(rhs(x)). |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
point_transform_affine3d <b><a name='operator'></a>operator</b><font color='#5555FF'>*</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> point_transform_affine3d<font color='#5555FF'>&</font> lhs, |
|
<font color='#0000FF'>const</font> point_transform_affine<font color='#5555FF'>&</font> rhs |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns a transformation TFORM(x) that is equivalent to lhs(rhs(x)). That |
|
is, for all valid x: TFORM(x) == lhs(rhs(x)). |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
point_transform_affine3d <b><a name='inv'></a>inv</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> point_transform_affine3d<font color='#5555FF'>&</font> trans |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- If trans is an invertible transformation then this function returns a new |
|
transformation that is the inverse of trans. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
point_transform_affine3d <b><a name='rotate_around_x'></a>rotate_around_x</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>double</u></font> angle |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Returns a transformation that rotates a point around the x axis in a |
|
counter-clockwise direction by angle radians. That is, the rotation appears |
|
counter-clockwise when the x axis points toward the observer, the coordinate |
|
system is right-handed, and the angle is positive. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
point_transform_affine3d <b><a name='rotate_around_y'></a>rotate_around_y</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>double</u></font> angle |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Returns a transformation that rotates a point around the y axis in a |
|
counter-clockwise direction by angle radians. That is, the rotation appears |
|
counter-clockwise when the y axis points toward the observer, the coordinate |
|
system is right-handed, and the angle is positive. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
point_transform_affine3d <b><a name='rotate_around_z'></a>rotate_around_z</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>double</u></font> angle |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Returns a transformation that rotates a point around the z axis in a |
|
counter-clockwise direction by angle radians. That is, the rotation appears |
|
counter-clockwise when the z axis points toward the observer, the coordinate |
|
system is right-handed, and the angle is positive. |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
point_transform_affine3d <b><a name='translate_point'></a>translate_point</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font>,<font color='#979000'>3</font><font color='#5555FF'>></font><font color='#5555FF'>&</font> delta |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns a transformation that simply translates points by adding delta to |
|
them. That is, this function returns: |
|
point_transform_affine3d(identity_matrix<double>(3),delta); |
|
!*/</font> |
|
|
|
point_transform_affine3d <b><a name='translate_point'></a>translate_point</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'><u>double</u></font> x, |
|
<font color='#0000FF'><u>double</u></font> y, |
|
<font color='#0000FF'><u>double</u></font> z |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns translate_point(vector<double>(x,y,z)) |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<font color='#0000FF'>class</font> <b><a name='camera_transform'></a>camera_transform</b> |
|
<b>{</b> |
|
<font color='#009900'>/*! |
|
WHAT THIS OBJECT REPRESENTS |
|
This object maps 3D points into the image plane of a camera. Therefore, |
|
you can use it to compute 2D representations of 3D data from the point of |
|
view of some camera in 3D space. |
|
|
|
THREAD SAFETY |
|
It is safe for multiple threads to make concurrent accesses to this object |
|
without synchronization. |
|
!*/</font> |
|
|
|
<font color='#0000FF'>public</font>: |
|
|
|
<b><a name='camera_transform'></a>camera_transform</b> <font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- #get_camera_pos() == vector<double>(1,1,1) |
|
- #get_camera_looking_at() == vector<double>(0,0,0) |
|
- #get_camera_up_direction() == vector<double>(0,0,1) |
|
- #get_camera_field_of_view() == 90 |
|
- #get_num_pixels() == 1 |
|
!*/</font> |
|
|
|
<b><a name='camera_transform'></a>camera_transform</b> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font> camera_pos, |
|
<font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font> camera_looking_at, |
|
<font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font> camera_up_direction, |
|
<font color='#0000FF'>const</font> <font color='#0000FF'><u>double</u></font> camera_field_of_view, |
|
<font color='#0000FF'>const</font> <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> num_pixels |
|
<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
requires |
|
- 0 < camera_field_of_view < 180 |
|
ensures |
|
- #get_camera_pos() == camera_pos |
|
- #get_camera_looking_at() == camera_looking_at |
|
- #get_camera_up_direction() == camera_up_direction |
|
- #get_camera_field_of_view() == camera_field_of_view |
|
- #get_num_pixels() == num_pixels |
|
!*/</font> |
|
|
|
dpoint <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Maps the given 3D point p into the 2D image plane defined by the camera |
|
parameters given to this object's constructor. The 2D point in the image |
|
plane is returned. |
|
!*/</font> |
|
|
|
dpoint <b><a name='operator'></a>operator</b><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> <font face='Lucida Console'>(</font> |
|
<font color='#0000FF'>const</font> vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font><font color='#5555FF'>&</font> p, |
|
<font color='#0000FF'><u>double</u></font><font color='#5555FF'>&</font> scale, |
|
<font color='#0000FF'><u>double</u></font><font color='#5555FF'>&</font> distance |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- Maps the given 3D point p into the 2D image plane defined by the camera |
|
parameters given to this object's constructor. The 2D point in the image |
|
plane is returned. |
|
- #scale == a number that tells you how large things are at the point p. |
|
Objects further from the camera appear smaller, in particular, they |
|
appear #scale times their normal size. |
|
- #distance == how far away the point is from the image plane. Objects in |
|
front of the camera will have a positive distance and those behind a |
|
negative distance. |
|
!*/</font> |
|
|
|
vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font> <b><a name='get_camera_pos'></a>get_camera_pos</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the position, in 3D space, of the camera. When operator() is |
|
invoked it maps 3D points into the image plane of this camera. |
|
!*/</font> |
|
|
|
vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font> <b><a name='get_camera_looking_at'></a>get_camera_looking_at</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the point in 3D space the camera is pointed at. |
|
!*/</font> |
|
|
|
vector<font color='#5555FF'><</font><font color='#0000FF'><u>double</u></font><font color='#5555FF'>></font> <b><a name='get_camera_up_direction'></a>get_camera_up_direction</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns a vector that defines what direction is "up" for the camera. |
|
This means that as you travel from the bottom of the image plane to the |
|
top you will be traveling in the direction of this vector. Note that |
|
get_camera_up_direction() doesn't need to be orthogonal to the camera's |
|
line of sight (i.e. get_camera_looking_at()-get_camera_pos()), it just |
|
needs to not be an exact multiple of the line of sight. Any necessary |
|
orthogonalization will be taken care of internally. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>double</u></font> <b><a name='get_camera_field_of_view'></a>get_camera_field_of_view</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- returns the field of view of the camera in degrees. |
|
!*/</font> |
|
|
|
<font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> <b><a name='get_num_pixels'></a>get_num_pixels</b><font face='Lucida Console'>(</font> |
|
<font face='Lucida Console'>)</font> <font color='#0000FF'>const</font>; |
|
<font color='#009900'>/*! |
|
ensures |
|
- 3D points that fall within the field of view of the camera are mapped by |
|
operator() into the pixel coordinates of a get_num_pixels() by |
|
get_num_pixels() image. Therefore, you can use the output of operator() |
|
to index into an image. However, you still need to perform bounds |
|
checking as there might be 3D points outside the field of view of the |
|
camera and those will be mapped to 2D points outside the image. |
|
!*/</font> |
|
|
|
<b>}</b>; |
|
|
|
<font color='#0000FF'><u>void</u></font> <b><a name='serialize'></a>serialize</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> camera_transform<font color='#5555FF'>&</font> item, std::ostream<font color='#5555FF'>&</font> out<font face='Lucida Console'>)</font>; |
|
<font color='#0000FF'><u>void</u></font> <b><a name='deserialize'></a>deserialize</b> <font face='Lucida Console'>(</font>camera_transform<font color='#5555FF'>&</font> item, std::istream<font color='#5555FF'>&</font> in<font face='Lucida Console'>)</font>; |
|
<font color='#009900'>/*! |
|
provides serialization support |
|
!*/</font> |
|
|
|
<font color='#009900'>// ---------------------------------------------------------------------------------------- |
|
</font> |
|
<b>}</b> |
|
|
|
<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_POINT_TrANSFORMS_ABSTRACT_Hh_ |
|
</font> |
|
|
|
|
|
</pre></body></html> |