KJB
|
#include <turntable_camera.h>
Public Member Functions | |
Turntable_camera () | |
Turntable_camera (const Perspective_camera &cam, const Vector &rotation_axis, const Vector &turntable_origin, int num_positions, bool clockwise=true) | |
template<typename Iterator > | |
Turntable_camera (const Perspective_camera &cam, const Vector &rotation_axis, const Vector &turntable_origin, Iterator angles_begin, Iterator angles_end) | |
Turntable_camera (const Turntable_camera &other) | |
Turntable_camera & | operator= (const Turntable_camera &other) |
virtual void | swap (Turntable_camera &other) |
const Vector & | get_principal_point () const |
void | set_principal_point (const Vector &pt) |
void | set_active_camera (size_t i) const |
void | set_next () |
void | set_previous () |
void | pass_to_opengl (bool clean_buffers=false) const |
const Perspective_camera & | get_neutral_camera () const |
const Vector & | get_origin () const |
const Vector & | get_rotation_axis () const |
const std::vector< double > & | get_angles () const |
size_t | get_current_index () const |
const Perspective_camera & | get_current_camera () const |
size_t | size () const |
const std::vector< size_t > & | index_list () |
void | set_index_list (const Index_range &indices) |
If not all angles should be used, use this to specify the indices of angles to use. More... | |
void | evenly_space_cameras (size_t n) |
virtual const Perspective_camera | operator[] (int i) const |
std::vector< Perspective_camera > | to_cameras () const |
A class representing a collection of cameras, oriented in a turntable-style configuration.
This class is based on a set of assumptions that are true in turntable scenarios:
* All cameras have same intrinsic parameters * All cameras positions are related by pure rotation around the same axis. * All camera orientations are related by rotation around the same axis.
This could also apply to a robot turning an object in it's hand.
kjb::Turntable_camera::Turntable_camera | ( | ) |
Create a null Turntable camera. Attempting to use this camera as-is will result in an abort (in DEVELOPMENT mode) or undefined behavior (in PRODUCTION mode). As such, it must be initialized to a valid camera using the assignment operator before using.
kjb::Turntable_camera::Turntable_camera | ( | const Perspective_camera & | cam, |
const Vector & | rotation_axis, | ||
const Vector & | turntable_origin, | ||
int | num_positions, | ||
bool | clockwise = true |
||
) |
Create a turntable camera assuming equal spacing of cameras.
The "Neutral" camera, i.e. camera at position 0 A direction vector representing the turntable's rotation axis. A position vector representing the turntable's origin, i.e. the center of rotation. This can be any point lying on the rotation line. The number of positions where images were captured, a.k.a "number of cameras". This number of cameras will be evenly spaced around the 390 degree circle. Whether or not turntable rotation is clockwise. Clockwise-ness is determined by looking in the direction of the rotation axis. Flipping the direction of the rotation axis will require flipping the clockwise boolean.
|
inline |
Create a turntable camera from an arbitrary collection of angles. Angles are relative to the rotation axis direction, following a right-handed convention; i.e. positive angles correspond to counter-clockwise rotation when looking in the direction of the axis vector.
The call below will create a configuration with the world origin coinciding with the turntable origin; the turntable axis pointing upward; using the angles stored in the collection "angles":
cam | The "Neutral" camera, i.e. camera at position 0 |
rotation_axis | A direction vector representing the turntable's rotation axis. |
turntable_origin | A position vector representing the turntable's origin, i.e. the center of rotation. This can be any point lying on the rotation line. |
angles_begin | An iterator representing the beginning of a sequence of angles. |
angles_end | An iterator representing one-past-the-end of a sequence of angles. |
kjb::Turntable_camera::Turntable_camera | ( | const Turntable_camera & | other | ) |
Standard copy constructor.
void kjb::Turntable_camera::evenly_space_cameras | ( | size_t | n | ) |
|
inline |
|
inline |
|
inline |
|
inline |
Returns the neutral camera, a.k.a. camera 0
|
inline |
|
inline |
Returns the principal point of the camera. Same for all cameras.
|
inline |
|
inline |
|
inline |
Simple assignment
|
virtual |
|
inline |
Send modelview and projection matrices to opengl corresponding to the active camera's extrinsic and intrinsic parameters.
Missing_dependency | if code was compiled without OpenGL. |
void kjb::Turntable_camera::set_active_camera | ( | size_t | i | ) | const |
Set the i-th camera to be active.
Index_out_of_bounds | if i exceeds the number of turntable angles. |
void kjb::Turntable_camera::set_index_list | ( | const Index_range & | indices | ) |
If not all angles should be used, use this to specify the indices of angles to use.
void kjb::Turntable_camera::set_next | ( | ) |
Set the next camera to be active, or if the last camera is active, activate the first camera.
void kjb::Turntable_camera::set_previous | ( | ) |
Set the previous camera to be active, or if the first camera is active, activate the last camera.
|
inline |
Set the principal point of all cameras.
|
inline |
|
virtual |
Swap state with another Turntable_camera. Running time is O(c).
std::vector< Perspective_camera > kjb::Turntable_camera::to_cameras | ( | ) | const |