qCC_db  version 2.5.4 (Qt) - 19 Apr 2014
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ccCameraSensor Class Reference

Camera (projective) sensor. More...

#include <ccCameraSensor.h>

Inheritance diagram for ccCameraSensor:
Inheritance graph
[legend]
Collaboration diagram for ccCameraSensor:
Collaboration graph
[legend]

Classes

struct  FrustumInformation
 Frustum information structure. More...
 
struct  IntrinsicParameters
 Intrinsic parameters of the camera sensor. More...
 
struct  UncertaintyParameters
 Parameters ion order to correct lens distortion. More...
 

Public Member Functions

 ccCameraSensor ()
 Default constructor.
 
virtual ~ccCameraSensor ()
 Destructor.
 
bool frustrumIsDrawn () const
 Returns whether the frustum should be displayed or not.
 
void drawFrustrum (bool state)
 Sets whether the frustum should be displayed or not.
 
bool frustrumPlanesAreDrawn () const
 Returns whether the frustum planes should be displayed or not.
 
void drawFrustrumPlanes (bool state)
 Sets whether the frustum planes should be displayed or not.
 
const ccGLMatrixgetProjectionMatrix () const
 Returns the camera projection matrix.
 
bool fromLocalCoordToGlobalCoord (const CCVector3 &localCoord, CCVector3 &globalCoord) const
 Computes the coordinates of a 3D point in the global coordinate system knowing its coordinates in the sensor coordinate system. More...
 
bool fromGlobalCoordToLocalCoord (const CCVector3 &globalCoord, CCVector3 &localCoord) const
 Computes the coordinates of a 3D point in the sensor coordinate system knowing its coordinates in the global coordinate system. More...
 
bool fromLocalCoordToImageCoord (const CCVector3 &localCoord, CCVector2i &imageCoord) const
 Computes the coordinates of a 3D point in the global coordinate system knowing its coordinates in the sensor coordinate system. More...
 
bool fromImageCoordToLocalCoord (const CCVector2i &imageCoord, CCVector3 &localCoord, bool withLensCorrection, float depth=0) const
 Computes the coordinates of a 3D point in the sensor coordinate system knowing its coordinates in the global coordinate system. More...
 
bool fromGlobalCoordToImageCoord (const CCVector3 &globalCoord, CCVector3 &localCoord, CCVector2i &imageCoord) const
 Computes the coordinates of a 3D point in the image knowing its coordinates in the global coordinate system. More...
 
bool fromImageCoordToGlobalCoord (const CCVector2i &imageCoord, CCVector3 &localCoord, CCVector3 &globalCoord, bool withLensCorrection, float depth=0) const
 Computes the global coordinates of a 3D points from its 3D coordinates (pixel position in the image) More...
 
bool fromRealImCoordToIdealImCoord (const CCVector2i &real, CCVector2i &ideal) const
 Apply the Brown's lens correction to the real projection (through a lens) of a 3D point in the image. More...
 
bool computeUncertainty (const CCVector2i &pixel, const float depth, Vector3Tpl< ScalarType > &sigma) const
 Knowing the ideal projection of a 3D point, computes what would be the real projection (through a lens) More...
 
bool computeUncertainty (CCLib::ReferenceCloud *points, std::vector< Vector3Tpl< ScalarType > > &accuracy) const
 Computes the coordinates of a 3D point in the sensor coordinate system knowing its coordinates in the global coordinate system. More...
 
bool isGlobalCoordInFrustrum (const CCVector3 &globalCoord) const
 Tests if a 3D point is in the field of view of the camera. More...
 
void filterOctree (ccOctree *octree, std::vector< unsigned > &inCameraFrustrum)
 Filters an octree : all the box visible in the frustum will be drawn in red. More...
 
virtual CC_CLASS_ENUM getClassID () const
 Returns class ID. More...
 
virtual bool isSerializable () const
 Returns whether object is serializable of not.
 
virtual ccBBox getMyOwnBB ()
 Returns the entity bounding-box only. More...
 
void computeGlobalPlaneCoefficients (float planeCoefficients[6][4], CCVector3 ptsFrustrum[8], CCVector3 edges[6], CCVector3 &center)
 Compute the coefficients of the 6 planes frustrum in the global coordinates system (normal vector are headed the frustrum inside), the edges direction vectors and the frustrum center. More...
 
- Public Member Functions inherited from ccSensor
 ccSensor (QString name)
 Default constructor.
 
virtual CC_SENSOR_TYPE getType () const
 Returns the sensor type. More...
 
virtual uchar checkVisibility (const CCVector3 &P) const
 Returns the "visibility type" of a point. More...
 
ccIndexedTransformationBuffergetPositions ()
 Returns associated positions.
 
void setPositions (ccIndexedTransformationBuffer *positions)
 Sets associated positions.
 
bool addPosition (ccGLMatrix &trans, double index)
 Adds a new position (shortcut) More...
 
bool getAbsoluteTransformation (ccIndexedTransformation &trans, double index) const
 Returns the absolute transformation between the world and the "optical" center (shortcut) More...
 
bool getActiveAbsoluteTransformation (ccIndexedTransformation &trans) const
 Gets currently active absolute transformation.
 
bool getActiveAbsoluteCenter (CCVector3 &vec) const
 Gets currently active absolute position.
 
bool getActiveAbsoluteRotation (ccGLMatrix &rotation) const
 Gets currently active rotation matrix (without translation)
 
virtual void setRigidTransformation (const ccGLMatrix &mat)
 Sets the rigid transformation between this sensor and its associated positions. More...
 
virtual ccGLMatrixgetRigidTransformation ()
 Returns the rigid transformation between this sensor and its associated positions.
 
virtual const ccGLMatrixgetRigidTransformation () const
 Returns the rigid transformation between this sensor and its associated positions (const version)
 
void getIndexBounds (double &minIndex, double &maxIndex) const
 Gets index boundaries (shortcut)
 
double getActiveIndex () const
 Sets currently active index (displayed position, etc.)
 
void setActiveIndex (double index)
 Sets currently active index (displayed position, etc.)
 
void setGraphicScale (PointCoordinateType scale)
 Sets the sensor graphic representation scale.
 
PointCoordinateType getGraphicScale () const
 Returns the sensor graphic representation scale.
 
- Public Member Functions inherited from ccHObject
 ccHObject (QString name=QString())
 Default constructor. More...
 
virtual ~ccHObject ()
 Default destructor.
 
virtual QIcon getIcon () const
 Returns the icon associated to this entity. More...
 
ccHObjectgetParent () const
 Returns parent object. More...
 
void addDependency (ccHObject *otherObject, int flags, bool additive=true)
 Adds a new dependence (additive or not) More...
 
int getDependencyFlagsWith (const ccHObject *otherObject)
 Returns the dependency flags with a given object. More...
 
void removeDependencyWith (const ccHObject *otherObject)
 Removes any dependency flags with a given object. More...
 
void removeDependencyFlag (ccHObject *otherObject, DEPENDENCY_FLAGS flag)
 Removes a given dependency flag. More...
 
virtual bool addChild (ccHObject *child, int dependencyFlags=DP_PARENT_OF_OTHER, int insertIndex=-1)
 Adds a child. More...
 
unsigned getChildrenNumber () const
 Returns the number of children. More...
 
ccHObjectgetChild (unsigned childPos) const
 Returns the ith child. More...
 
ccHObjectfind (int uniqueID)
 Finds an entity in this object hierarchy. More...
 
unsigned filterChildren (Container &filteredChildren, bool recursive=false, CC_CLASS_ENUM filter=CC_TYPES::OBJECT) const
 Collects the children corresponding to a certain pattern. More...
 
void detachChild (ccHObject *child)
 Detaches a specific child. More...
 
void detatchAllChildren ()
 Removes a specific child. More...
 
void removeChild (ccHObject *child)
 
void removeChild (int pos)
 Removes a specific child given its index. More...
 
void removeAllChildren ()
 Removes all children.
 
int getChildIndex (const ccHObject *aChild) const
 Returns child index.
 
void swapChildren (unsigned firstChildIndex, unsigned secondChildIndex)
 Swaps two children.
 
int getIndex () const
 Returns index relatively to its parent or -1 if no parent.
 
void transferChild (ccHObject *child, ccHObject &newParent)
 Transfer a given child to another parent.
 
void transferChildren (ccHObject &newParent, bool forceFatherDependent=false)
 Transfer all children to another parent.
 
ccHObjectgetFirstChild () const
 Shortcut: returns first child.
 
ccHObjectgetLastChild () const
 Shortcut: returns last child.
 
bool isAncestorOf (const ccHObject *anObject) const
 Returns true if the current object is an ancestor of the specified one.
 
virtual ccBBox getBB (bool relative=true, bool withGLfeatures=false, const ccGenericGLDisplay *window=NULL)
 Returns bounding-box. More...
 
virtual void draw (CC_DRAW_CONTEXT &context)
 Draws entity and its children.
 
virtual bool isDisplayed () const
 Returns whether the object is actually displayed (visible) or not.
 
virtual bool isBranchEnabled () const
 Returns whether the object and all its ancestors are enabled.
 
 ccHObject_recursive_call1 (setSelected, bool, setSelected_recursive)
 
 ccHObject_recursive_call1 (setDisplay, ccGenericGLDisplay *, setDisplay_recursive)
 
 ccHObject_recursive_call1 (removeFromDisplay, ccGenericGLDisplay *, removeFromDisplay_recursive)
 
 ccHObject_recursive_call0 (prepareDisplayForRefresh, prepareDisplayForRefresh_recursive)
 
 ccHObject_recursive_call0 (refreshDisplay, refreshDisplay_recursive)
 
 ccHObject_recursive_call0 (toggleVisibility, toggleVisibility_recursive)
 
 ccHObject_recursive_call0 (toggleColors, toggleColors_recursive)
 
 ccHObject_recursive_call0 (toggleNormals, toggleNormals_recursive)
 
 ccHObject_recursive_call0 (toggleSF, toggleSF_recursive)
 
 ccHObject_recursive_call0 (toggleShowName, toggleShowName_recursive)
 
 ccHObject_recursive_call0 (toggleMaterials, toggleMaterials_recursive)
 
void applyGLTransformation_recursive (ccGLMatrix *trans=0)
 Applies the active OpenGL transformation to the entity (recursive) More...
 
virtual CCVector3 getBBCenter ()
 Returns the bounding-box center. More...
 
void notifyGeometryUpdate ()
 Notifies all dependent entities that the geometry of this entity has changed.
 
virtual ccBBox getDisplayBB ()
 Returns the entity GL display bounding-box. More...
 
virtual bool toFile (QFile &out) const
 Saves data to binay stream. More...
 
virtual bool fromFile (QFile &in, short dataVersion, int flags)
 Reimplemented from ccSerializableObject::fromFile. More...
 
virtual bool isShareable () const
 Returns whether object is shareable or not. More...
 
void setSelectionBehavior (SelectionBehavior mode)
 Sets selection behavior (when displayed) More...
 
SelectionBehavior getSelectionBehavior () const
 Returns selection behavior.
 
virtual unsigned getUniqueIDForDisplay () const
 Returns object unqiue ID used for display.
 
- Public Member Functions inherited from ccObject
 ccObject (QString name=QString())
 Default constructor. More...
 
virtual QString getName () const
 Returns object name.
 
virtual void setName (const QString &name)
 Sets object name.
 
virtual unsigned getUniqueID () const
 Returns object unique ID.
 
virtual void setUniqueID (unsigned ID)
 Changes unique ID. More...
 
virtual bool isEnabled () const
 Returns whether the object is enabled or not. More...
 
virtual void setEnabled (bool state)
 Sets the "enabled" property. More...
 
virtual bool isLocked () const
 Returns whether the object is locked or not. More...
 
virtual void setLocked (bool state)
 Sets the "enabled" property. More...
 
bool isGroup () const
 
bool isLeaf () const
 
bool isCustom () const
 
bool isHierarchy () const
 
bool isKindOf (CC_CLASS_ENUM type) const
 
bool isA (CC_CLASS_ENUM type) const
 
QVariant getMetaData (QString key) const
 Returns a given associated meta data. More...
 
bool removeMetaData (QString key)
 Removes a given associated meta data. More...
 
void setMetaData (QString key, QVariant data)
 Sets a meta data element. More...
 
bool hasMetaData (QString key)
 Says if a metadata with the given key exists or not. More...
 
const QVariantMap & metaData () const
 Returns meta-data map (const only)
 
- Public Member Functions inherited from ccSerializableObject
virtual ~ccSerializableObject ()
 Desctructor.
 
- Public Member Functions inherited from ccDrawableObject
 ccDrawableObject ()
 Default constructor.
 
virtual bool isVisible () const
 Returns whether entity is visible or not.
 
virtual void setVisible (bool state)
 Sets entity visibility.
 
virtual void toggleVisibility ()
 Toggles visibility.
 
virtual bool isVisiblityLocked () const
 Returns whether visibilty is locked or not.
 
virtual void lockVisibility (bool state)
 Locks/unlocks visibilty. More...
 
virtual bool isSelected () const
 Returns whether entity is selected or not.
 
virtual void setSelected (bool state)
 Selects/unselects entity.
 
virtual ccBBox getFitBB (ccGLMatrix &trans)
 Returns best-fit bounding-box (if available) More...
 
virtual void drawBB (const colorType col[])
 Draws absolute (axis aligned) bounding-box.
 
virtual void getDrawingParameters (glDrawParams &params) const
 Returns main OpenGL paramters for this entity. More...
 
virtual bool hasColors () const
 Returns whether colors are enabled or not.
 
virtual bool colorsShown () const
 Returns whether colors are shown or not.
 
virtual void showColors (bool state)
 Sets colors visibility.
 
virtual void toggleColors ()
 Toggles colors display state.
 
virtual bool hasNormals () const
 Returns whether normals are enabled or not.
 
virtual bool normalsShown () const
 Returns whether normals are shown or not.
 
virtual void showNormals (bool state)
 Sets normals visibility.
 
virtual void toggleNormals ()
 Toggles normals display state.
 
virtual bool hasDisplayedScalarField () const
 Returns whether an active scalar field is available or not.
 
virtual bool hasScalarFields () const
 Returns whether one or more scalar fields are instantiated. More...
 
virtual void showSF (bool state)
 Sets active scalarfield visibility.
 
virtual void toggleSF ()
 Toggles SF display state.
 
virtual bool sfShown () const
 Returns whether active scalar field is visible.
 
virtual void toggleMaterials ()
 Toggles material display state.
 
virtual void showNameIn3D (bool state)
 Sets whether name should be displayed in 3D.
 
virtual bool nameShownIn3D () const
 Returns whether name is displayed in 3D or not.
 
virtual void toggleShowName ()
 Toggles name in 3D display state.
 
virtual bool isColorOverriden () const
 Returns whether colors are currently overriden by a temporary (unique) color. More...
 
virtual const colorType * getTempColor () const
 Returns current temporary (unique) color.
 
virtual void setTempColor (const colorType *col, bool autoActivate=true)
 Sets current temporary (unique) More...
 
virtual void enableTempColor (bool state)
 Set temporary color activation state.
 
virtual void removeFromDisplay (const ccGenericGLDisplay *win)
 Unlinks entity from a GL display (only if it belongs to it of course)
 
virtual void setDisplay (ccGenericGLDisplay *win)
 Sets associated GL display.
 
virtual ccGenericGLDisplaygetDisplay () const
 Returns associated GL display.
 
virtual void redrawDisplay ()
 Redraws associated GL display.
 
virtual void prepareDisplayForRefresh ()
 Sets associated GL display 'refreshable' before global refresh. More...
 
virtual void refreshDisplay ()
 Refreshes associated GL display. More...
 
virtual void setGLTransformation (const ccGLMatrix &trans)
 Associates entity with a GL transformation (rotation + translation) More...
 
virtual void enableGLTransformation (bool state)
 Enables/disables associated GL transformation. More...
 
virtual bool isGLTransEnabled () const
 Returns whether a GL transformation is enabled or not.
 
virtual const ccGLMatrixgetGLTransformation () const
 Retuns associated GL transformation. More...
 
virtual void resetGLTransformation ()
 Resets associated GL transformation. More...
 
virtual void rotateGL (const ccGLMatrix &rotMat)
 Mutliplies (left) current GL transformation by a rotation matrix. More...
 
virtual void translateGL (const CCVector3 &trans)
 Translates current GL transformation by a rotation matrix. More...
 

Protected Member Functions

void computeProjectionMatrix ()
 Compute the projection matrix (from intrinsic parameters)
 
void computeFrustumCorners ()
 Computes the eight corners of the frustrum.
 
virtual bool toFile_MeOnly (QFile &out) const
 Save own object data. More...
 
virtual bool fromFile_MeOnly (QFile &in, short dataVersion, int flags)
 Loads own object data. More...
 
virtual void drawMeOnly (CC_DRAW_CONTEXT &context)
 Draws the entity only (not its children)
 
- Protected Member Functions inherited from ccSensor
virtual void applyGLTransformation (const ccGLMatrix &trans)
 Applies a GL transformation to the entity. More...
 
- Protected Member Functions inherited from ccHObject
virtual void setParent (ccHObject *anObject)
 Sets parent object.
 
virtual void drawNameIn3D (CC_DRAW_CONTEXT &context)
 Draws the entity name in 3D. More...
 
virtual void onDeletionOf (const ccHObject *obj)
 This method is called when another object is deleted. More...
 
virtual void onUpdateOf (ccHObject *obj)
 This method is called when another object (geometry) is updated. More...
 
- Protected Member Functions inherited from ccObject
virtual bool getFlagState (CC_OBJECT_FLAG flag) const
 Returns flag state.
 
virtual void setFlagState (CC_OBJECT_FLAG flag, bool state)
 Sets flag state. More...
 

Protected Attributes

IntrinsicParameters m_intrinsicParams
 Camera intrinsic parameters.
 
UncertaintyParameters m_uncertaintyParams
 Lens distortion parameters.
 
FrustumInformation m_frustrumInfos
 Frustrum information structure. More...
 
ccGLMatrix m_projecMatrix
 Intrinsic parameters matrix.
 
- Protected Attributes inherited from ccSensor
ccIndexedTransformationBufferm_posBuffer
 Positions buffer (optional)
 
ccGLMatrix m_rigidTransformation
 Rigid transformation between this sensor and its associated positions. More...
 
double m_activeIndex
 Active index (for displayed position, etc.)
 
Vector3Tpl< colorType > m_color
 Color of the sensor. More...
 
PointCoordinateType m_scale
 Sensor graphic representation scale.
 
- Protected Attributes inherited from ccHObject
ccHObjectm_parent
 Object's parent.
 
Container m_children
 Object's children.
 
SelectionBehavior m_selectionBehavior
 Selection behavior.
 
std::map< ccHObject *, int > m_dependencies
 Dependencies map. More...
 
- Protected Attributes inherited from ccObject
QString m_name
 Object name.
 
unsigned m_flags
 Object flags.
 
QVariantMap m_metaData
 Associated meta-data.
 
- Protected Attributes inherited from ccDrawableObject
bool m_visible
 Specifies whether the object is visible or not. More...
 
bool m_selected
 Specifies whether the object is selected or not.
 
bool m_lockedVisibility
 Specifies whether the visibility can be changed by user or not.
 
bool m_colorsDisplayed
 Specifies whether colors should be displayed.
 
bool m_normalsDisplayed
 Specifies whether normals should be displayed.
 
bool m_sfDisplayed
 Specifies whether scalar field should be displayed.
 
colorType m_tempColor [3]
 Temporary (unique) color.
 
bool m_colorIsOverriden
 Temporary (unique) color activation state.
 
ccGLMatrix m_glTrans
 Current GL transformation. More...
 
bool m_glTransEnabled
 Current GL transformation activation state. More...
 
bool m_showNameIn3D
 Whether name is displayed in 3D or not.
 
ccGenericGLDisplaym_currentDisplay
 Currently associated GL display.
 

Additional Inherited Members

- Public Types inherited from ccHObject
enum  DEPENDENCY_FLAGS {
  DP_NONE = 0, DP_NOTIFY_OTHER_ON_DELETE = 1, DP_NOTIFY_OTHER_ON_UPDATE = 2, DP_DELETE_OTHER = 8,
  DP_PARENT_OF_OTHER = 24
}
 Dependency flags. More...
 
enum  SelectionBehavior { SELECTION_AA_BBOX, SELECTION_FIT_BBOX, SELECTION_IGNORED }
 Behavior when selected.
 
typedef std::vector< ccHObject * > Container
 standard ccHObject container (for children, etc.)
 
- Public Types inherited from ccSerializableObject
enum  DeserializationFlags { DF_POINT_COORDS_64_BITS = 1, DF_SCALAR_VAL_32_BITS = 2 }
 Deserialization flags (bit-field) More...
 
- Static Public Member Functions inherited from ccHObject
static ccHObjectNew (CC_CLASS_ENUM objectType, const char *name=0)
 Static factory. More...
 
- Static Public Member Functions inherited from ccObject
static unsigned GetCurrentDBVersion ()
 Returns current database version.
 
static void ResetUniqueIDCounter ()
 Resets the object's unique ID counter. More...
 
static unsigned GetNextUniqueID ()
 Returns a new unassigned unique ID. More...
 
static unsigned GetLastUniqueID ()
 Returns last assigned unique ID. More...
 
static CC_CLASS_ENUM ReadClassIDFromFile (QFile &in, short dataVersion)
 Helper: reads out class ID from a binary stream. More...
 
- Static Public Member Functions inherited from ccSerializableObject
static bool WriteError ()
 Sends a custom error message (write error) and returns 'false'. More...
 
static bool ReadError ()
 Sends a custom error message (read error) and returns 'false'. More...
 
static bool MemoryError ()
 Sends a custom error message (not enough memory) and returns 'false'. More...
 
static bool CorruptError ()
 Sends a custom error message (corrupted file) and returns 'false'. More...
 
- Static Protected Member Functions inherited from ccObject
static void UpdateLastUniqueID (unsigned lastID)
 Sets last assigned unique ID. More...
 

Detailed Description

Camera (projective) sensor.

Member Function Documentation

void ccCameraSensor::computeGlobalPlaneCoefficients ( float  planeCoefficients[6][4],
CCVector3  ptsFrustrum[8],
CCVector3  edges[6],
CCVector3 &  center 
)

Compute the coefficients of the 6 planes frustrum in the global coordinates system (normal vector are headed the frustrum inside), the edges direction vectors and the frustrum center.

Parameters
planeCoefficientscoefficients of the six planes
edgesdirection vectors of the frustrum edges (there are 12 edges but some of them are colinear)
ptsFrustrumthe 8 frustrum corners in the global coordinates system
centercenter of the the frustrum circumscribed sphere
bool ccCameraSensor::computeUncertainty ( const CCVector2i &  pixel,
const float  depth,
Vector3Tpl< ScalarType > &  sigma 
) const

Knowing the ideal projection of a 3D point, computes what would be the real projection (through a lens)

Warning
The first pixel is (0,0) and the last (width-1,height-1)
Parameters
[in]ideal2D coordinates of the ideal projection
[out]realwhat would be the real 2D coordinates of the projection trough a lensComputes the uncertainty of a point knowing its depth (from the sensor view point) and pixel projection coordinates
pixelcoordinates of the pixel where the 3D points is projected –> !! Note that the first index is (0,0) and the last (width-1,height-1) !!
depthdepth from sensor center to 3D point (must be positive)
sigmauncertainty vector (along X, Y and Z)
Returns
operation has succeded (typically, errors occur when the initial pixel coordinates are not into the image boundaries, or when the depth of the 3D point is negative)
bool ccCameraSensor::computeUncertainty ( CCLib::ReferenceCloud *  points,
std::vector< Vector3Tpl< ScalarType > > &  accuracy 
) const

Computes the coordinates of a 3D point in the sensor coordinate system knowing its coordinates in the global coordinate system.

Parameters
pointsthe points we want to compute the uncertainty
accuracyto get back the uncertainty TODO lensDistortion if we want to take the lens distortion into consideration
Returns
success
void ccCameraSensor::filterOctree ( ccOctree octree,
std::vector< unsigned > &  inCameraFrustrum 
)

Filters an octree : all the box visible in the frustum will be drawn in red.

Parameters
octreeOctree
inCameraFrustrumindices of points in the frustrum
bool ccCameraSensor::fromFile_MeOnly ( QFile &  in,
short  dataVersion,
int  flags 
)
protectedvirtual

Loads own object data.

Called by 'fromFile' (recursive scheme) To be overloaded (but still called;) by subclass.

Parameters
ininput file
dataVersionfile version
flagsdeserialization flags (see ccSerializableObject::DeserializationFlags)

various parameters (dataVersion>=35)

Reimplemented from ccSensor.

bool ccCameraSensor::fromGlobalCoordToImageCoord ( const CCVector3 &  globalCoord,
CCVector3 &  localCoord,
CCVector2i &  imageCoord 
) const

Computes the coordinates of a 3D point in the image knowing its coordinates in the global coordinate system.

Parameters
globalCoordglobal coordinates of the 3D point
localCoordto get back the local coordinates of the 3D point
imageCoordto get back the image coordinates of the projected 3D point –> !! Note that the first index is (0,0) and the last (width-1,height-1) !! TODO withLensError if we want to simulate what the projection would be with an imperfect lens
Returns
if operation has succeded (typically, errors occur when the projection of the initial 3D points is not into the image boundaries, or when the 3D point is behind the camera)
bool ccCameraSensor::fromGlobalCoordToLocalCoord ( const CCVector3 &  globalCoord,
CCVector3 &  localCoord 
) const

Computes the coordinates of a 3D point in the sensor coordinate system knowing its coordinates in the global coordinate system.

Parameters
globalCoordglobal coordinates of the 3D point (input)
localCoordcorresponding local coordinates of the 3D point (output)
bool ccCameraSensor::fromImageCoordToGlobalCoord ( const CCVector2i &  imageCoord,
CCVector3 &  localCoord,
CCVector3 &  globalCoord,
bool  withLensCorrection,
float  depth = 0 
) const

Computes the global coordinates of a 3D points from its 3D coordinates (pixel position in the image)

Parameters
imageCoordimage coordinates of the pixel (input) –> !! Note that the first index is (0,0) and the last (width-1,height-1) !!
localCoordlocal coordinates of the corresponding 3D point (output)
globalCoordglobal coordinates of the corresponding 3D point (output)
withLensCorrectionif we want to correct the initial pixel coordinates with the lens correction formula
depthif known, depth of the input pixel, in order to recover third coordinates (must be positive) ; if depth is 0.0, then the reprojection is made in the focal plane
Returns
if operation has succeded (typically, errors occur when the initial pixel coordinates are not into the image boundaries)
bool ccCameraSensor::fromImageCoordToLocalCoord ( const CCVector2i &  imageCoord,
CCVector3 &  localCoord,
bool  withLensCorrection,
float  depth = 0 
) const

Computes the coordinates of a 3D point in the sensor coordinate system knowing its coordinates in the global coordinate system.

Parameters
imageCoordimage coordinates of the pixel (input) –> !! Note that the first index is (0,0) and the last (width-1,height-1) !!
localCoordlocal coordinates of the corresponding 3D point (output)
withLensCorrectionif we want to correct the initial pixel coordinates with the lens correction formula
depthif known, depth of the input pixel in meters, in order to recover third coordinates (must be positive) ; if depth is 0.0, then the reprojection is made in the focal plane
Returns
if operation has succeded (typically, errors occur when the initial pixel coordinates are not into the image boundaries)
bool ccCameraSensor::fromLocalCoordToGlobalCoord ( const CCVector3 &  localCoord,
CCVector3 &  globalCoord 
) const

Computes the coordinates of a 3D point in the global coordinate system knowing its coordinates in the sensor coordinate system.

Parameters
localCoordlocal coordinates of the 3D point (input)
globalCoordcorresponding global coordinates of the 3D point (output)
bool ccCameraSensor::fromLocalCoordToImageCoord ( const CCVector3 &  localCoord,
CCVector2i &  imageCoord 
) const

Computes the coordinates of a 3D point in the global coordinate system knowing its coordinates in the sensor coordinate system.

Parameters
localCoordlocal coordinates of the 3D point (input)
imageCoordimage coordinates of the projected point on the image (output) –> !! Note that the first index is (0,0) and the last (width-1,height-1) !! TODO: withLensError if we want to simulate what the projection would be with an imperfect lens
Returns
if operation has succeded (typically, errors occur when the projection of the initial 3D points is not into the image boundaries, or when the 3D point is behind the camera)
bool ccCameraSensor::fromRealImCoordToIdealImCoord ( const CCVector2i &  real,
CCVector2i &  ideal 
) const

Apply the Brown's lens correction to the real projection (through a lens) of a 3D point in the image.

Parameters
realreal 2D coordinates of a pixel (asumming that this pixel coordinate is obtained after projection through a lens) (input) !! Note that the first index is (0,0) and the last (width-1,height-1) !!
idealafter applying lens correction (output) –> !! Note that the first index is (0,0) and the last (width-1,height-1) !!
virtual CC_CLASS_ENUM ccCameraSensor::getClassID ( ) const
inlinevirtual

Returns class ID.

Returns
class unique ID

Reimplemented from ccSensor.

ccBBox ccCameraSensor::getMyOwnBB ( )
virtual

Returns the entity bounding-box only.

Children bboxes are ignored.

Returns
bounding-box

Reimplemented from ccHObject.

bool ccCameraSensor::isGlobalCoordInFrustrum ( const CCVector3 &  globalCoord) const

Tests if a 3D point is in the field of view of the camera.

Parameters
globalCoordglobal coordinates of the 3D point TODO withLensCorrection if we want to take the lens distortion into consideration
Returns
if operation has succeded
bool ccCameraSensor::toFile_MeOnly ( QFile &  out) const
protectedvirtual

Save own object data.

Called by 'toFile' (recursive scheme) To be overloaded (but still called;) by subclass.

various parameters (dataVersion>=35)

Reimplemented from ccSensor.

Member Data Documentation

FrustumInformation ccCameraSensor::m_frustrumInfos
protected

Frustrum information structure.

Used to draw it properly.


The documentation for this class was generated from the following files: