MSERCalculation.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
27
28#include "ObjectHypothesis.h"
29
30class CStereoCalibration;
31class CByteImage;
32
34{
35public:
36 CMSERCalculation(void);
38
39 static void FindMSERs2D(const CByteImage* pRGBImage,
40 const CByteImage* pHSVImage,
41 std::vector<CMSERDescriptor*>& aMSERDescriptors);
42 static void FindMSERs3D(const CByteImage* pByteImageLeft,
43 const CByteImage* pByteImageRight,
44 CStereoCalibration* pStereoCalibration,
45 const float fToleranceFactor,
46 std::vector<CMSERDescriptor3D*>& aRegions3D);
47 static void StereoMatchMSERs(const std::vector<CMSERDescriptor*>& aMSERDescriptorsLeft,
48 const std::vector<CMSERDescriptor*>& aMSERDescriptorsRight,
49 CStereoCalibration* pStereoCalibration,
50 const float fToleranceFactor,
51 std::vector<CMSERDescriptor3D*>& aRegions3D);
52
53 static CMSERDescriptor* CreateMSERDescriptor(std::vector<Vec2d>* aPoints2D,
54 const CByteImage* pHSVImage);
56 CMSERDescriptor* pMSERRight,
57 CStereoCalibration* pStereoCalibration);
58
59 static float HistogramDistanceL2(CMSERDescriptor* pDescriptor1, CMSERDescriptor* pDescriptor2);
60 static float HistogramDistanceChi2(CMSERDescriptor* pDescriptor1,
61 CMSERDescriptor* pDescriptor2);
62
63 static void
64 SortQuadrangleCorners(Vec2d* pCorners, Vec2d& vUp, Vec2d& vLow, Vec2d& vLeft, Vec2d& vRight);
66 Vec2d vLow,
67 Vec2d vLeft,
68 Vec2d vRight,
69 const CByteImage* pHSVImage,
70 float* pHistogram,
71 const int nHistogramSize,
72 int& nSaturationSum);
73
74 static void
75 GetMeanAndCovariance2D(std::vector<Vec2d>& aPoints2D, Vec2d& vMean, Mat2d& mCovariance);
76 static void GetEigenvaluesAndEigenvectors2D(Mat2d mMatrix2D,
77 float& fLambda1,
78 float& fLambda2,
79 Vec2d& vE1,
80 Vec2d& vE2);
81
82 static void CreateHSVHistograms(CMSERDescriptor* pDescriptor, const CByteImage* pHSVImage);
83};
static float HistogramDistanceChi2(CMSERDescriptor *pDescriptor1, CMSERDescriptor *pDescriptor2)
static void GetEigenvaluesAndEigenvectors2D(Mat2d mMatrix2D, float &fLambda1, float &fLambda2, Vec2d &vE1, Vec2d &vE2)
static CMSERDescriptor3D * CreateMSERDescriptor3D(CMSERDescriptor *pMSERLeft, CMSERDescriptor *pMSERRight, CStereoCalibration *pStereoCalibration)
static void SortQuadrangleCorners(Vec2d *pCorners, Vec2d &vUp, Vec2d &vLow, Vec2d &vLeft, Vec2d &vRight)
static float HistogramDistanceL2(CMSERDescriptor *pDescriptor1, CMSERDescriptor *pDescriptor2)
static void StereoMatchMSERs(const std::vector< CMSERDescriptor * > &aMSERDescriptorsLeft, const std::vector< CMSERDescriptor * > &aMSERDescriptorsRight, CStereoCalibration *pStereoCalibration, const float fToleranceFactor, std::vector< CMSERDescriptor3D * > &aRegions3D)
static void CreateWeightedHueHistogramWithinQuadrangle(Vec2d vUp, Vec2d vLow, Vec2d vLeft, Vec2d vRight, const CByteImage *pHSVImage, float *pHistogram, const int nHistogramSize, int &nSaturationSum)
static void GetMeanAndCovariance2D(std::vector< Vec2d > &aPoints2D, Vec2d &vMean, Mat2d &mCovariance)
static void CreateHSVHistograms(CMSERDescriptor *pDescriptor, const CByteImage *pHSVImage)
static CMSERDescriptor * CreateMSERDescriptor(std::vector< Vec2d > *aPoints2D, const CByteImage *pHSVImage)
static void FindMSERs3D(const CByteImage *pByteImageLeft, const CByteImage *pByteImageRight, CStereoCalibration *pStereoCalibration, const float fToleranceFactor, std::vector< CMSERDescriptor3D * > &aRegions3D)
static void FindMSERs2D(const CByteImage *pRGBImage, const CByteImage *pHSVImage, std::vector< CMSERDescriptor * > &aMSERDescriptors)