16 #include <unordered_set>
37 float pixelSize_mm[2];
45 float principal_point[2];
51 assert(pixelSize_mm[1] > 0);
52 return (vertFocal_pix * pixelSize_mm[0]) / pixelSize_mm[1];
58 NO_DISTORTION_MODEL = 0,
59 SIMPLE_RADIAL_DISTORTION =
63 EXTENDED_RADIAL_DISTORTION =
70 typedef QSharedPointer<LensDistortionParameters>
Shared;
82 typedef QSharedPointer<RadialDistortionParameters>
Shared;
89 return SIMPLE_RADIAL_DISTORTION;
102 typedef QSharedPointer<RadialDistortionParameters>
Shared;
110 return EXTENDED_RADIAL_DISTORTION;
126 typedef QSharedPointer<BrownDistortionParameters>
Shared;
133 return BROWN_DISTORTION;
140 float principalPointOffset[2];
142 float linearDisparityParams[2];
145 float K_BrownParams[3];
147 float P_BrownParams[2];
163 bool initFrustumCorners();
168 bool initFrustumHull();
204 void setVertFocal_pix(
float vertFocal_pix);
207 return m_intrinsicParams.vertFocal_pix;
211 return m_intrinsicParams.horizFocal_pix();
215 void setVerticalFov_rad(
float fov_rad);
218 return m_intrinsicParams.vFOV_rad;
223 return m_intrinsicParams;
226 void setIntrinsicParameters(
const IntrinsicParameters& params);
230 return m_distortionParams;
234 m_distortionParams = params;
249 inline void drawFrustum(
bool state) { m_frustumInfos.drawFrustum = state; }
253 return m_frustumInfos.drawSidePlanes;
258 m_frustumInfos.drawSidePlanes = state;
268 bool fromLocalCoordToGlobalCoord(
const CCVector3& localCoord,
277 bool fromGlobalCoordToLocalCoord(
const CCVector3& globalCoord,
290 bool fromLocalCoordToImageCoord(
const CCVector3& localCoord,
292 bool withLensError =
true)
const;
305 bool fromImageCoordToLocalCoord(
const CCVector2& imageCoord,
308 bool withLensCorrection =
true)
const;
320 bool fromGlobalCoordToImageCoord(
const CCVector3& globalCoord,
322 bool withLensError =
true)
const;
334 bool fromImageCoordToGlobalCoord(
const CCVector2& imageCoord,
337 bool withLensCorrection =
true)
const;
348 bool fromRealImCoordToIdealImCoord(
const CCVector2& real,
377 KeyPoint(
float Px,
float Py,
unsigned indexInCloud)
378 :
x(Px),
y(Py), index(indexInCloud) {}
391 std::vector<KeyPoint>& keypointsImage)
const;
406 std::vector<KeyPoint>& keypointsImage,
408 double* minCorner =
nullptr,
409 double* maxCorner =
nullptr,
410 double* realCorners =
nullptr)
const;
427 bool undistortImages =
true,
428 double* minCorner =
nullptr,
429 double* maxCorner =
nullptr,
430 double* realCorners =
nullptr)
const;
443 static bool OrthoRectifyAsImages(
444 std::vector<ccImage*> images,
449 QDir* outputDir =
nullptr,
450 std::vector<ccImage*>* orthoRectifiedImages =
nullptr,
451 std::vector<std::pair<double, double>>* relativePos =
nullptr);
466 bool computeOrthoRectificationParams(
469 std::vector<KeyPoint>& keypointsImage,
486 bool computeUncertainty(
const CCVector2& pixel,
507 QImage undistort(
const QImage&
image)
const;
523 bool isGlobalCoordInFrustum(
535 bool computeGlobalPlaneCoefficients(
float planeCoefficients[6][4],
559 static float ConvertFocalPixToMM(
float focal_pix,
float ccdPixelSize_mm);
562 static float ConvertFocalMMToPix(
float focal_mm,
float ccdPixelSize_mm);
565 static float ComputeFovRadFromFocalPix(
float focal_pix,
int imageSize_pix);
568 static float ComputeFovRadFromFocalMm(
float focal_mm,
float ccdSize_mm);
577 void computeProjectionMatrix();
582 bool computeFrustumCorners();
585 bool toFile_MeOnly(QFile& out,
short dataVersion)
const override;
590 LoadedIDMap& oldToNewIDMap)
override;
641 unsigned char level)
const {
644 std::unordered_set<cloudViewer::DgmOctree::CellCode>::const_iterator
670 std::vector<std::pair<unsigned, CCVector3>>& pointsToTest,
671 std::vector<unsigned>& inCameraFrustum,
672 const float planesCoefficients[6][4],
694 const float planesCoefficients[6][4],
716 const float planesCoefficients[6][4],
725 std::unordered_set<cloudViewer::DgmOctree::CellCode>
728 std::unordered_set<cloudViewer::DgmOctree::CellCode>
731 std::unordered_set<cloudViewer::DgmOctree::CellCode>
float PointCoordinateType
Type of the coordinates of a (N-D) point.
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
std::shared_ptr< core::Tensor > image
Camera (projective) sensor.
const ecvColor::Rgb & getPlaneColor() const
FrustumInformation m_frustumInfos
Frustum information structure.
ecvColor::Rgb m_plane_color
LensDistortionParameters::Shared m_distortionParams
Lens distortion parameters.
virtual CV_CLASS_ENUM getClassID() const override
Returns class ID.
float getVerticalFov_rad() const
Returns the (vertical) field of view in radians.
const cloudViewer::geometry::LineSet & getNearPlane() const
cloudViewer::geometry::LineSet m_arrow
bool frustumIsDrawn() const
Returns whether the frustum should be displayed or not.
float getVertFocal_pix() const
Returns vertical focal (in pixels)
void drawFrustumPlanes(bool state)
Sets whether the frustum planes should be displayed or not.
const cloudViewer::geometry::LineSet & getSideLines() const
bool frustumPlanesAreDrawn() const
Returns whether the frustum planes should be displayed or not.
const IntrinsicParameters & getIntrinsicParameters() const
Returns intrinsic parameters.
cloudViewer::geometry::LineSet m_nearPlane
float getHorizFocal_pix() const
Returns horizontal focal (in pixels)
const cloudViewer::geometry::LineSet & getArrow() const
cloudViewer::geometry::LineSet m_axis
void setPlaneColor(ecvColor::Rgb color)
cloudViewer::geometry::LineSet m_sideLines
const cloudViewer::geometry::LineSet & getAxis() const
const LensDistortionParameters::Shared & getDistortionParameters() const
Returns uncertainty parameters.
IntrinsicParameters m_intrinsicParams
Camera intrinsic parameters.
virtual bool isSerializable() const override
Returns whether object is serializable of not.
bool m_projectionMatrixIsValid
Whether the intrinsic matrix is valid or not.
DistortionModel
Supported distortion models.
double getFocalLength() const
void setDistortionParameters(LensDistortionParameters::Shared params)
Sets uncertainty parameters.
ccGLMatrix m_projectionMatrix
Intrinsic parameters matrix.
void drawFrustum(bool state)
Sets whether the frustum should be displayed or not.
Float version of ccGLMatrixTpl.
virtual void drawMeOnly(CC_DRAW_CONTEXT &context)
Draws the entity only (not its children)
virtual ccBBox getOwnFitBB(ccGLMatrix &trans)
Returns best-fit bounding-box (if available)
virtual ccBBox getOwnBB(bool withGLFeatures=false)
Returns the entity's own bounding-box.
void computeFrustumIntersectionWithOctree(std::vector< std::pair< unsigned, CCVector3 >> &pointsToTest, std::vector< unsigned > &inCameraFrustum, const float planesCoefficients[6][4], const CCVector3 ptsFrustum[8], const CCVector3 edges[6], const CCVector3 ¢er)
cloudViewer::DgmOctree * m_associatedOctree
OctreeCellVisibility
Definition of the state of a cell compared to a frustum.
OctreeCellVisibility separatingAxisTest(const CCVector3 &bbMin, const CCVector3 &bbMax, const float planesCoefficients[6][4], const CCVector3 frustumCorners[8], const CCVector3 frustumEdges[6], const CCVector3 &frustumCenter)
Separating Axis Test.
bool build(cloudViewer::DgmOctree *octree)
Prepares structure for frustum filtering.
OctreeCellVisibility positionFromFrustum(cloudViewer::DgmOctree::CellCode truncatedCode, unsigned char level) const
Returns the cell visibility.
std::unordered_set< cloudViewer::DgmOctree::CellCode > m_cellsBuilt[cloudViewer::DgmOctree::MAX_OCTREE_LEVEL+1]
void computeFrustumIntersectionByLevel(unsigned char level, cloudViewer::DgmOctree::CellCode parentTruncatedCode, OctreeCellVisibility parentResult, const float planesCoefficients[6][4], const CCVector3 ptsFrustum[8], const CCVector3 edges[6], const CCVector3 ¢er)
std::unordered_set< cloudViewer::DgmOctree::CellCode > m_cellsInFrustum[cloudViewer::DgmOctree::MAX_OCTREE_LEVEL+1]
ccOctreeFrustumIntersector()
Default constructor.
std::unordered_set< cloudViewer::DgmOctree::CellCode > m_cellsIntersectFrustum[cloudViewer::DgmOctree::MAX_OCTREE_LEVEL+1]
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Generic sensor interface.
short minimumFileVersion_MeOnly() const override
bool fromFile_MeOnly(QFile &in, short dataVersion, int flags, LoadedIDMap &oldToNewIDMap) override
Loads own object data.
virtual void hideShowDrawings(CC_DRAW_CONTEXT &context)
virtual bool applyViewport()
Apply sensor 'viewport' to a 3D view.
bool toFile_MeOnly(QFile &out, short dataVersion) const override
Save own object data.
virtual void clearDrawings()
The octree structure used throughout the library.
unsigned CellCode
Type of the code of an octree cell.
static const int MAX_OCTREE_LEVEL
Max octree subdivision level.
A generic 3D point cloud with index-based point access.
A very simple point cloud (no point duplication)
LineSet define a sets of lines in 3D. A typical application is to display the point cloud corresponde...
Brown's distortion model + Linear Disparity.
QSharedPointer< BrownDistortionParameters > Shared
Shared pointer type.
virtual DistortionModel getModel() const override
Returns distortion model type.
Extended radial distortion model.
virtual DistortionModel getModel() const override
Returns distortion model type.
QSharedPointer< RadialDistortionParameters > Shared
Shared pointer type.
ExtendedRadialDistortionParameters()
Default initializer.
float k3
3rd radial distortion coefficient
Intrinsic parameters of the camera sensor.
float horizFocal_pix() const
Returns the horizontal focal pix.
KeyPoint()
Default constructor.
unsigned index
Index in associated point cloud.
float y
2D 'y' coordinate (in pixels)
KeyPoint(float Px, float Py, unsigned indexInCloud)
Constructor from a pixel and its index in associated cloud.
float x
2D 'x' coordinate (in pixels)
Lens distortion parameters (interface)
virtual DistortionModel getModel() const =0
Returns distortion model type.
QSharedPointer< LensDistortionParameters > Shared
Shared pointer type.
virtual ~LensDistortionParameters()
Virtual destructor.
Simple radial distortion model.
virtual DistortionModel getModel() const override
Returns distortion model type.
float k2
2nd radial distortion coefficient
RadialDistortionParameters()
Default initializer.
float k1
1st radial distortion coefficient
QSharedPointer< RadialDistortionParameters > Shared
Shared pointer type.