gramods
|
Coordinates mapper that compensates for the optical effects as described by a rectilinear camera model. More...
#include <RectilinearCameraModel.hh>
Classes | |
struct | Impl |
Public Member Functions | |
std::string | getCommonCode () override |
std::string | getTo2DCode () override |
std::string | getTo3DCode () override |
void | setCommonUniforms (GLuint program) override |
void | setTo2DUniforms (GLuint program) override |
void | setKDistortion (gmCore::float3 k) |
Set the k distortion parameters (k1 k2 k3). More... | |
void | setPDistortion (gmCore::float2 p) |
Set the p distortion parameters (p1 p2). More... | |
void | setFocalDistance (gmCore::float2 f) |
Set the focal distance (fx fy) for the camera model, expressed relative to the image size. More... | |
void | setFocalOffset (gmCore::float2 c) |
Set the focal offset (cx cy) for the camera model, expressed relative to the image size. More... | |
![]() | |
virtual void | setTo3DUniforms (GLuint program) |
Called by the code that is using this CoordinatesMapper object, to let it set the uniforms used by the to-3D code. More... | |
virtual std::string | getDefaultKey () override |
Returns the default key, in Configuration, for the Object. More... | |
![]() | |
Object () | |
Initializes internal data. More... | |
virtual | ~Object () |
Cleaning up internal data. More... | |
virtual void | initialize () |
Called to initialize the Object. More... | |
virtual void | accept (Visitor *visitor) |
Calls the visitors apply method with this as argument. More... | |
virtual void | traverse (Visitor *visitor) |
Calls the child Object's accept method, if such exist. More... | |
bool | isInitialized () |
Returns true if the Object is initialized. More... | |
Static Public Attributes | |
static gramods::gmCore::OFactory::OFactoryInformation | _gm_ofi |
Additional Inherited Members | |
![]() | |
const std::string | withVarId (std::string) const |
![]() | |
const std::string | var_id |
Coordinates mapper that compensates for the optical effects as described by a rectilinear camera model.
|
overridevirtual |
Reimplemented from gramods::gmGraphics::CoordinatesMapper.
|
overridevirtual |
Reimplemented from gramods::gmGraphics::CoordinatesMapper.
|
overridevirtual |
Reimplemented from gramods::gmGraphics::CoordinatesMapper.
|
overridevirtual |
Reimplemented from gramods::gmGraphics::CoordinatesMapper.
void gramods::gmGraphics::RectilinearCameraModel::setFocalDistance | ( | gmCore::float2 | f | ) |
Set the focal distance (fx fy) for the camera model, expressed relative to the image size.
Calibration output from OpenCV is typically expressed in pixels so divide by the pixel size in each dimension, respectively, before entering values here.
To convert from focal distance in mm and sensor ratio, divide the focal distance by the size of your sensor (e.g. 28 mm lens with sensor size 23.5 x 15.6 mm gives fx = 28/23.5 and fy = 28/15.6). Use the largest sensor dimension for your largest image dimension. If the sensor size is unknown but your camera reports standard 35 mm equivalent focal distance, then instead divide this focal distance value by the standard sensor size, 36 x 27 mm (e.g. 28 mm equivalent gives fx = 28/36 and fy = 28/27). Adjust the smaller dimension if the image ratio does not perfectly match the standard ratio (4/3). If your camera only reports it actual focal distance (e.g. 2.2 mm in a phone camera) then multiply this by the reported crop factor and proceed by using this value in the standard sensor estimation.
XML-attribute: focalDistance
void gramods::gmGraphics::RectilinearCameraModel::setFocalOffset | ( | gmCore::float2 | c | ) |
Set the focal offset (cx cy) for the camera model, expressed relative to the image size.
A straight projection should have an offset close to (0.5 0.5). Calibration output from OpenCV is typically expressed in pixels so divide by resolution before entering values here.
XML-attribute: focalOffset
void gramods::gmGraphics::RectilinearCameraModel::setKDistortion | ( | gmCore::float3 | k | ) |
Set the k distortion parameters (k1 k2 k3).
XML-attribute: kDistortion
void gramods::gmGraphics::RectilinearCameraModel::setPDistortion | ( | gmCore::float2 | p | ) |
Set the p distortion parameters (p1 p2).
XML-attribute: pDistortion
|
overridevirtual |
Reimplemented from gramods::gmGraphics::CoordinatesMapper.