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 <pcl/point_cloud.h>
27#include <pcl/point_types.h>
28
29#include "ObjectHypothesis.h"
30#include <Math/Math2d.h>
31
32
33// forward declarations
34class CSIFTFeatureCalculator;
35class CStereoCalibration;
36class CCalibration;
37class CByteImage;
38class CStereoMatcher;
39
41{
42public:
45
46 void GetAllFeaturePoints(const CByteImage* pImageLeftColor,
47 const CByteImage* pImageRightColor,
48 const CByteImage* pImageLeftGrey,
49 const CByteImage* pImageRightGrey,
50 const int nDisparityPointDistance,
51 CStereoCalibration* pStereoCalibration,
52 CSIFTFeatureArray& aAllSIFTPoints,
53 std::vector<CMSERDescriptor3D*>& aAllMSERs,
54 std::vector<CHypothesisPoint*>& aPointsFromDepthImage,
55 CByteImage* pDisparityImage,
56 std::vector<Vec3d>* pAll3DPoints = NULL);
57
58#ifdef OLP_USE_DEPTH_MAP
59
60 void GetAllFeaturePoints(const CByteImage* pImageLeftColor,
61 const CByteImage* pImageLeftGrey,
62 const pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloud,
63 const int nDisparityPointDistance,
64 CSIFTFeatureArray& aAllSIFTPoints,
65 std::vector<CMSERDescriptor3D*>& aAllMSERs,
66 std::vector<CHypothesisPoint*>& aPointsFromDepthImage,
67 const CCalibration* calibration);
68#endif
69
70private:
71 void FilterForegroundPoints(const std::vector<CHypothesisPoint*>& aAllPoints,
72 const CByteImage* pForegroundImage,
73 std::vector<CHypothesisPoint*>& aForegroundPoints);
74
75 void CalculateForegroundRatioOfHypothesis(const CObjectHypothesis* pHypothesis,
76 const CByteImage* pForegroundImage,
77 float& fForegroundRatio,
78 int& nNumForegroundPixels);
79 static inline void GetEnclosingRectangle(const Vec2d* pPoints,
80 const int nNumPoints,
81 Vec2d& p1,
82 Vec2d& p2,
83 Vec2d& p3,
84 Vec2d& p4,
85 bool& bRotated);
86 static inline int CountForegroundPixelsInRectangle(const Vec2d vMiddleMin,
87 const Vec2d vMinMiddle,
88 const Vec2d vMaxMiddle,
89 const Vec2d vMiddleMax,
90 const CByteImage* pForegroundImage);
91
92 void GetPointsFromDisparity(const CByteImage* pImageLeftColor,
93 const CByteImage* pImageRightColor,
94 const CByteImage* pImageLeftGrey,
95 const CByteImage* pImageRightGrey,
96 CStereoCalibration* pStereoCalibration,
97 const int nDisparityPointDistance,
98 std::vector<CHypothesisPoint*>& aPointsFromDisparity,
99 CByteImage* pDisparityImage,
100 std::vector<Vec3d>* pAll3DPoints);
101
102 void CalculateSmoothedDisparityImage(float* pInputDisparity,
103 float* pSmoothedDisparity,
104 const int nRadius = 1);
105
106#ifdef OLP_USE_DEPTH_MAP
107 static Vec3d GetCorresponding3DPoint(const Vec2d point2D,
108 const pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloud);
109#endif
110
111 static const int m_nMaxNumInterestPoints = 4000;
112 Vec2d* m_pInterestPoints;
113
114 CSIFTFeatureCalculator* m_pSIFTFeatureCalculator;
115};
CDynamicArrayTemplate< CSIFTFeatureEntry * > CSIFTFeatureArray
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)