FeatureCalculation.h
Go to the documentation of this file.
1 /*
2  * This file is part of ArmarX.
3  *
4  * Copyright (C) 2011-2016, High Performance Humanoid Technologies (H2T), Karlsruhe Institute of Technology (KIT), all rights reserved.
5  *
6  * ArmarX is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 as
8  * published by the Free Software Foundation.
9  *
10  * ArmarX is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * @package
19  * @author
20  * @date
21  * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
22  * GNU General Public License
23  */
24 #pragma once
25 
26 #include "ObjectHypothesis.h"
27 
28 #include <Math/Math2d.h>
29 
30 #include <pcl/point_types.h>
31 #include <pcl/point_cloud.h>
32 #include <pcl/point_types.h>
33 
34 
35 // forward declarations
36 class CSIFTFeatureCalculator;
37 class CStereoCalibration;
38 class CCalibration;
39 class CByteImage;
40 class CStereoMatcher;
41 
42 
44 {
45 public:
48 
49  void GetAllFeaturePoints(const CByteImage* pImageLeftColor, const CByteImage* pImageRightColor, const CByteImage* pImageLeftGrey, const CByteImage* pImageRightGrey, const int nDisparityPointDistance, CStereoCalibration* pStereoCalibration,
50  CSIFTFeatureArray& aAllSIFTPoints, std::vector<CMSERDescriptor3D*>& aAllMSERs, std::vector<CHypothesisPoint*>& aPointsFromDepthImage, CByteImage* pDisparityImage, std::vector<Vec3d>* pAll3DPoints = NULL);
51 
52 #ifdef OLP_USE_DEPTH_MAP
53 
54  void GetAllFeaturePoints(const CByteImage* pImageLeftColor, const CByteImage* pImageLeftGrey, const pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloud, const int nDisparityPointDistance,
55  CSIFTFeatureArray& aAllSIFTPoints, std::vector<CMSERDescriptor3D*>& aAllMSERs, std::vector<CHypothesisPoint*>& aPointsFromDepthImage, const CCalibration* calibration);
56 #endif
57 
58 private:
59 
60  void FilterForegroundPoints(const std::vector<CHypothesisPoint*>& aAllPoints, const CByteImage* pForegroundImage, std::vector<CHypothesisPoint*>& aForegroundPoints);
61 
62  void CalculateForegroundRatioOfHypothesis(const CObjectHypothesis* pHypothesis, const CByteImage* pForegroundImage, float& fForegroundRatio, int& nNumForegroundPixels);
63  static inline void GetEnclosingRectangle(const Vec2d* pPoints, const int nNumPoints, Vec2d& p1, Vec2d& p2, Vec2d& p3, Vec2d& p4, bool& bRotated);
64  static inline int CountForegroundPixelsInRectangle(const Vec2d vMiddleMin, const Vec2d vMinMiddle, const Vec2d vMaxMiddle, const Vec2d vMiddleMax, const CByteImage* pForegroundImage);
65 
66  void GetPointsFromDisparity(const CByteImage* pImageLeftColor, const CByteImage* pImageRightColor, const CByteImage* pImageLeftGrey, const CByteImage* pImageRightGrey, CStereoCalibration* pStereoCalibration,
67  const int nDisparityPointDistance, std::vector<CHypothesisPoint*>& aPointsFromDisparity, CByteImage* pDisparityImage, std::vector<Vec3d>* pAll3DPoints);
68 
69  void CalculateSmoothedDisparityImage(float* pInputDisparity, float* pSmoothedDisparity, const int nRadius = 1);
70 
71 #ifdef OLP_USE_DEPTH_MAP
72  static Vec3d GetCorresponding3DPoint(const Vec2d point2D, const pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloud);
73 #endif
74 
75  static const int m_nMaxNumInterestPoints = 4000;
76  Vec2d* m_pInterestPoints;
77 
78  CSIFTFeatureCalculator* m_pSIFTFeatureCalculator;
79 };
80 
ObjectHypothesis.h
CSIFTFeatureArray
CDynamicArrayTemplate< CSIFTFeatureEntry * > CSIFTFeatureArray
Definition: ObjectHypothesis.h:168
GfxTL::Vec2d
VectorXD< 2, double > Vec2d
Definition: VectorXD.h:694
CFeatureCalculation
Definition: FeatureCalculation.h:43
GfxTL::Vec3d
VectorXD< 3, double > Vec3d
Definition: VectorXD.h:695
CObjectHypothesis
Definition: ObjectHypothesis.h:249
CFeatureCalculation::CFeatureCalculation
CFeatureCalculation()
Definition: FeatureCalculation.cpp:60
CFeatureCalculation::~CFeatureCalculation
~CFeatureCalculation()
Definition: FeatureCalculation.cpp:71
CFeatureCalculation::GetAllFeaturePoints
void GetAllFeaturePoints(const CByteImage *pImageLeftColor, const CByteImage *pImageRightColor, const CByteImage *pImageLeftGrey, const CByteImage *pImageRightGrey, const int nDisparityPointDistance, CStereoCalibration *pStereoCalibration, CSIFTFeatureArray &aAllSIFTPoints, std::vector< CMSERDescriptor3D * > &aAllMSERs, std::vector< CHypothesisPoint * > &aPointsFromDepthImage, CByteImage *pDisparityImage, std::vector< Vec3d > *pAll3DPoints=NULL)
Definition: FeatureCalculation.cpp:78