IVT
ObjectFinderStereo.h
Go to the documentation of this file.
1 // ****************************************************************************
2 // This file is part of the Integrating Vision Toolkit (IVT).
3 //
4 // The IVT is maintained by the Karlsruhe Institute of Technology (KIT)
5 // (www.kit.edu) in cooperation with the company Keyetech (www.keyetech.de).
6 //
7 // Copyright (C) 2014 Karlsruhe Institute of Technology (KIT).
8 // All rights reserved.
9 //
10 // Redistribution and use in source and binary forms, with or without
11 // modification, are permitted provided that the following conditions are met:
12 //
13 // 1. Redistributions of source code must retain the above copyright
14 // notice, this list of conditions and the following disclaimer.
15 //
16 // 2. Redistributions in binary form must reproduce the above copyright
17 // notice, this list of conditions and the following disclaimer in the
18 // documentation and/or other materials provided with the distribution.
19 //
20 // 3. Neither the name of the KIT nor the names of its contributors may be
21 // used to endorse or promote products derived from this software
22 // without specific prior written permission.
23 //
24 // THIS SOFTWARE IS PROVIDED BY THE KIT AND CONTRIBUTORS “AS IS” AND ANY
25 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
26 // WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 // DISCLAIMED. IN NO EVENT SHALL THE KIT OR CONTRIBUTORS BE LIABLE FOR ANY
28 // DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
29 // (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 // LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
31 // ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 // THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 // ****************************************************************************
35 // ****************************************************************************
36 // Filename: ObjectFinderStereo.h
37 // Author: Pedram Azad
38 // Date: 2005
39 // ****************************************************************************
40 
41 
42 #ifndef _OBJECT_FINDER_STEREO_H_
43 #define _OBJECT_FINDER_STEREO_H_
44 
45 
46 // ****************************************************************************
47 // Necessary includes
48 // ****************************************************************************
49 
51 #include <string>
52 
53 
54 // ****************************************************************************
55 // Forward declarations
56 // ****************************************************************************
57 
61 class CObjectFinder;
62 class CByteImage;
63 class CCalibration;
64 class CStereoCalibration;
65 class CColorParameterSet;
66 
67 
68 
69 // ****************************************************************************
70 // CObjectFinderStereo
71 // ****************************************************************************
72 
74 {
75 public:
76  // constructor
78 
79  // destructor
81 
82 
83  // public methods
84  bool Init(const char *pCameraParameterFileName);
85  void Init(CStereoCalibration* pStereoCalibration);
86 
87  void SetColorParameterSet(const CColorParameterSet *pColorParameterSet);
88 
89  // first call this method for each new image
90  void PrepareImages(const CByteImage * const *ppImages, float fROIFactor = -1, bool bCalculateHSVImage = true);
91 
92  // then for each color call one of the FindObjects-methods
93  void FindObjects(const CByteImage * const *ppImages, CByteImage **ppResultImages, ObjectColor color, int nMinPointsPerRegion, bool bShowSegmentedImage);
94  void FindObjects(const CByteImage * const *ppImages, CByteImage **ppResultImages, ObjectColor color, int nMinPointsPerRegion, CByteImage **ppResultSegmentedImages);
95  void FindObjects(const CByteImage * const *ppImages, CByteImage **ppResultImages, ObjectColor colorName, int hue, int hue_tol, int min_sat, int max_sat, int min_v, int max_v, int nMinPointsPerRegion, bool bShowSegmentedImage);
96  void FindObjectsInSegmentedImage(const CByteImage * const *ppImages, CByteImage **ppResultImages, ObjectColor color, int nMinPointsPerRegion, bool bShowSegmentedImage);
97 
98  // finally call this method
99  int Finalize(float dMinZDistance, float fMaxZDistance, bool bInputImagesAreRectified, ObjectColor finalizeColor = eNone, float fMaxEpipolarDistance = 10, bool bUseDistortionParameters = true);
100 
101  // member access
105 
106  // use these methods for setting a region/entry filter
107  void SetRegionFilter(CRegionFilterInterface *pRegionFilter);
108  void SetObjectEntryFilter(CObjectEntryFilterInterface *pObjectEntryFilter) { m_pObjectEntryFilter = pObjectEntryFilter; }
109 
110  // use these methods for manipulating the internal object list
112  void ClearObjectList();
113  void AddObject(const Object3DEntry &entry);
114 
115  // use these methods for adding classifiers (mostly not used)
116  void AddObjectClassifier(CObjectClassifierInterface *pObjectClassifier);
117  void RemoveObjectClassifier(CObjectClassifierInterface *pObjectClassifier);
119 
120  // public attributes
122 
123 
124 protected:
125  // protected methods
126  void UpdateObjectFinderLists(Object2DList &resultListLeft, Object2DList &resultListRight);
127  int DetermineMatches(Object2DList &resultListLeft, Object2DList &resultListRight, float fMinZDistance, float fMaxZDistance, bool bInputImagesAreRectified, bool bUseDistortionParameters, ObjectColor finalizeColor, float fMaxYDiff);
128 
129  // protected attributes
133 
134 private:
135  // private attributes
136  std::vector<CObjectClassifierInterface*> m_objectClassifierList;
137  CObjectEntryFilterInterface *m_pObjectEntryFilter;
138  bool m_bOwnCalibration;
139 };
140 
141 
142 
143 #endif /* _OBJECT_FINDER_STEREO_H_ */
const CStereoCalibration * GetStereoCalibration()
void SetRegionFilter(CRegionFilterInterface *pRegionFilter)
void UpdateObjectFinderLists(Object2DList &resultListLeft, Object2DList &resultListRight)
void AddObjectClassifier(CObjectClassifierInterface *pObjectClassifier)
CByteImage * GetLeftSegmentationResult()
void SetColorParameterSet(const CColorParameterSet *pColorParameterSet)
void FindObjectsInSegmentedImage(const CByteImage *const *ppImages, CByteImage **ppResultImages, ObjectColor color, int nMinPointsPerRegion, bool bShowSegmentedImage)
CObjectFinder * m_pObjectFinderRight
void AddObject(const Object3DEntry &entry)
ObjectColor
int DetermineMatches(Object2DList &resultListLeft, Object2DList &resultListRight, float fMinZDistance, float fMaxZDistance, bool bInputImagesAreRectified, bool bUseDistortionParameters, ObjectColor finalizeColor, float fMaxYDiff)
std::vector< Object2DEntry > Object2DList
CStereoCalibration * m_pStereoCalibration
void RemoveObjectClassifier(CObjectClassifierInterface *pObjectClassifier)
void FindObjects(const CByteImage *const *ppImages, CByteImage **ppResultImages, ObjectColor color, int nMinPointsPerRegion, bool bShowSegmentedImage)
Camera model parameters and functions for a single camera.
Definition: Calibration.h:125
std::vector< Object3DEntry > Object3DList
int Finalize(float dMinZDistance, float fMaxZDistance, bool bInputImagesAreRectified, ObjectColor finalizeColor=eNone, float fMaxEpipolarDistance=10, bool bUseDistortionParameters=true)
CByteImage * GetRightSegmentationResult()
CObjectFinder * m_pObjectFinderLeft
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...
Definition: ByteImage.h:80
const Object3DList & GetObject3DList()
void SetObjectEntryFilter(CObjectEntryFilterInterface *pObjectEntryFilter)
bool Init(const char *pCameraParameterFileName)
Camera model and functions for a stereo camera system.
void PrepareImages(const CByteImage *const *ppImages, float fROIFactor=-1, bool bCalculateHSVImage=true)