32 #include <Math/Math2d.h>
33 #include <Math/Math3d.h>
36 #include <opencv2/opencv.hpp>
43 class CSIFTFeatureCalculator;
56 CByteImage* pImageRightColor,
57 CByteImage* pImageLeftGrey,
58 CByteImage* pImageRightGrey,
60 std::vector<CMSERDescriptor3D*>& aAllMSERs,
61 std::vector<CHypothesisPoint*>& aPointsFromDisparity,
65 std::vector<CMSERDescriptor3D*>& aMSERs,
66 std::vector<Vec3d>& aSigmaPoints,
67 const CByteImage* pLeftColorImage,
68 const CByteImage* pLeftGreyImage);
71 const Vec3d vCylinderAxis,
72 const Vec3d vCylinderCenter,
73 const float fCylinderRadius,
74 std::vector<CMSERDescriptor3D*>& aMSERs,
75 std::vector<Vec3d>& aSigmaPoints,
76 const CByteImage* pLeftColorImage,
77 const CByteImage* pLeftGreyImage);
80 const Vec3d vSphereCenter,
81 const float fSphereRadius,
82 std::vector<CMSERDescriptor3D*>& aMSERs,
83 std::vector<Vec3d>& aSigmaPoints,
84 const CByteImage* pLeftColorImage,
85 const CByteImage* pLeftGreyImage);
90 float GetVariance(
const CVec3dArray& avPoints,
Vec3d& vMean);
92 void RemoveOutliers(CVec3dArray& avPoints,
93 float fStdDevFactor = 2.0f,
94 std::vector<int>* paIndices = NULL);
96 bool FindCylinder(
const CVec3dArray& avSamplePoints,
97 const CVec3dArray& avAllPoints,
98 const float fToleranceThreshold,
99 const float fMaxRadius,
100 CVec3dArray& avResultPoints,
101 Vec3d& vCylinderAxis,
102 Vec3d& vCylinderCenter,
103 float& fCylinderRadius);
105 void QuickSort2DPointsX(CFloatMatrix& mPoints,
int nLeft,
int nRight);
107 void ClusterPointsRegularGrid2D(
const CVec3dArray& avPoints,
108 const CCalibration* calibration,
109 const int nNumSectionsX,
110 const int nNumSectionsY,
111 CVec3dArray*& pClusters,
114 bool RANSACCylinders(
const CVec3dArray& avPoints,
115 const CCalibration* calibration,
116 const float fToleranceThreshold,
117 const float fMaxRadius,
118 CVec3dArray& avCylinder);
120 bool RANSACCylinders2(
const CVec3dArray& avPoints,
121 const CCalibration* calibration,
122 const float fToleranceThreshold,
123 const float fMaxRadius,
124 CVec3dArray& avCylinder,
125 Vec3d& vCylinderAxis,
126 Vec3d& vCylinderCenter,
127 float& fCylinderRadius);
129 bool RANSACPlane(
const CVec3dArray& pointCandidates,
130 const float fRANSACThreshold,
131 const int nIterations,
132 CVec3dArray& resultPoints,
136 bool RANSACSphere(
const CVec3dArray& aPointCandidates,
137 const float fRANSACThreshold,
138 const float fMaxSphereRadius,
139 const int nMaxIterations,
140 CVec3dArray& aResultPoints,
146 std::vector<CMSERDescriptor3D*>& aMSERs,
147 std::vector<Vec3d>& aSigmaPoints,
148 const CByteImage* pLeftColorImage,
149 const CByteImage* pLeftGreyImage);
152 const CByteImage* pLeftGreyImage);
154 void ClusterXMeans(
const CVec3dArray& aPoints,
155 const int nMaxNumClusters,
156 const float fBICFactor,
157 std::vector<CVec3dArray*>& aaPointClusters);
159 inline void SortMSERsBySize(std::vector<CMSERDescriptor3D*>& aRegions3D);
160 inline void SortMSERsByX(std::vector<CMSERDescriptor3D*>& aRegions3D);
161 inline int FindRegionForPoint(
Vec3d vPoint, std::vector<CMSERDescriptor3D*>& aRegions3D);
163 inline void SortVec3dsByX(std::vector<Vec3d>& aPoints);
164 inline bool PointIsInList(
Vec3d vPoint, std::vector<Vec3d>& aPoints);
166 void CalculateSphere(
Vec3d vPoint1,
174 CVec3dArray m_vFeaturePoints3d;
176 CCalibration* calibration;
177 CSIFTFeatureCalculator* m_pSIFTFeatureCalculator;
180 CByteImage *m_pSaliencyImage, *m_pHypothesesCoveringImage, *m_pSaliencyHypothesisRegionsImage,
189 LCCPSegmentationWrapper *lccpSegmentation1, *lccpSegmentation2;