155 CByteImage *pResultImageLeft = ppResultImages ? ppResultImages[0] : 0;
156 CByteImage *pResultImageRight = ppResultImages ? ppResultImages[1] : 0;
164 CByteImage *pResultImageLeft = ppResultImages ? ppResultImages[0] : 0;
165 CByteImage *pResultImageRight = ppResultImages ? ppResultImages[1] : 0;
171 void CObjectFinderStereo::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)
173 CByteImage *pResultImageLeft = ppResultImages ? ppResultImages[0] : 0;
174 CByteImage *pResultImageRight = ppResultImages ? ppResultImages[1] : 0;
176 m_pObjectFinderLeft->
FindObjects(ppImages[0], pResultImageLeft, colorName, hue, hue_tol, min_sat, max_sat, min_v, max_v, nMinPointsPerRegion, bShowSegmentedImage);
177 m_pObjectFinderRight->
FindObjects(ppImages[1], pResultImageRight, colorName, hue, hue_tol, min_sat, max_sat, min_v, max_v, nMinPointsPerRegion, bShowSegmentedImage);
182 CByteImage *pResultImageLeft = ppResultImages ? ppResultImages[0] : 0;
183 CByteImage *pResultImageRight = ppResultImages ? ppResultImages[1] : 0;
195 if (finalizeColor ==
eNone)
213 for (i = 0; i < (int) resultListLeft.size(); i++)
214 resultListLeft.at(i).reserved = 0;
216 for (i = 0; i < (int) resultListRight.size(); i++)
217 resultListRight.at(i).reserved = 0;
220 for (i = 0; i < (int) oldObjectList.size(); i++)
224 if (finalizeColor !=
eNone && finalizeColor != objectEntry.
color)
229 int nMatchLeft = -1, nMatchRight = -1;
231 for (j = 0; j < (int) resultListLeft.size(); j++)
233 if (resultListLeft.at(j).id == region_left_id)
240 for (j = 0; j < (int) resultListRight.size(); j++)
241 if (resultListRight.at(j).id == region_right_id)
247 if (nMatchLeft != -1 && nMatchRight != -1)
250 objectEntry.
region_left = resultListLeft.at(nMatchLeft).region;
251 objectEntry.
region_right = resultListRight.at(nMatchRight).region;
259 resultListLeft.at(nMatchLeft).reserved = 1;
260 resultListRight.at(nMatchRight).reserved = 1;
267 for (i = 0; i < (int) resultListLeft.size(); i++)
271 if (!entryLeft.
reserved && (finalizeColor ==
eNone || entryLeft.
color == finalizeColor))
274 float best_diff = fMaxEpipolarDistance;
277 for (j = 0; j < (int) resultListRight.size(); j++)
292 if (ratio > 0.5f && ratio2 > 0.5f && y_diff < fMaxEpipolarDistance &&
294 position.z >= fMinZDistance && position.z <= fMaxZDistance && y_diff < best_diff)
313 entry.
sName =
"CompactObject";
342 for (i = 0; i < (int) resultListLeft.size(); i++)
343 if (!resultListLeft.at(i).reserved)
345 resultListLeft.erase(resultListLeft.begin() + i);
350 for (i = 0; i < (int) resultListRight.size(); i++)
351 if (!resultListRight.at(i).reserved)
353 resultListRight.erase(resultListRight.begin() + i);
364 for (j = 0; j < (int) resultListLeft.size(); j++)
369 entry.
type =
object.type;
372 for (j = 0; j < (int) resultListRight.size(); j++)
377 entry.
type =
object.type;
416 if (*it == pObjectClassifier)
void PrepareImages(const CByteImage *const *ppImages, float fROIFactor=-1, bool bCalculateHSVImage=true)
std::vector< CObjectClassifierInterface * > m_objectClassifierList
int Finalize(float dMinZDistance, float fMaxZDistance, bool bInputImagesAreRectified, ObjectColor finalizeColor=eNone, float fMaxEpipolarDistance=10, bool bUseDistortionParameters=true)
bool LoadCameraParameters(const char *pCameraParameterFileName, bool bTransformLeftCameraToIdentity=true)
Initializes the stereo camera model, given a file path to a stereo camera parameter file...
virtual bool CheckEntry(const Object3DEntry &entry)=0
CByteImage * GetRightSegmentationResult()
void AddObject(const Object3DEntry &entry)
void SetColorParameterSet(const CColorParameterSet *pColorParameterSet)
CByteImage * GetLeftSegmentationResult()
Data structure for the representation of a 3D vector.
Data structure for the representation of 8-bit grayscale images and 24-bit RGB (or HSV) color images ...
void RemoveObjectClassifier(CObjectClassifierInterface *pObjectClassifier)
void SetRegionFilter(CRegionFilterInterface *pRegionFilter)
CObjectEntryFilterInterface * m_pObjectEntryFilter
void FindObjects(const CByteImage *const *ppImages, CByteImage **ppResultImages, ObjectColor color, int nMinPointsPerRegion, bool bShowSegmentedImage)
void Calculate3DPoint(const Vec2d &cameraPointLeft, const Vec2d &cameraPointRight, Vec3d &worldPoint, bool bInputImagesAreRectified, bool bUseDistortionParameters=true, PointPair3d *pConnectionLine=0)
Computes a 3D point, given a point correspondence in both images, by performing stereo triangulation...
Object2DList m_objectList
float CalculateEpipolarLineInLeftImageDistance(const Vec2d &pointInLeftImage, const Vec2d &pointInRightImage)
Given a point correspondence, computes the distance from the epipolar line in the left image...
void ClearObjectClassifierList()
void SetVec(Vec3d &vec, float x, float y, float z)
void SetColorParameterSet(const CColorParameterSet *pColorParameterSet)
Object3DList m_objectList
CByteImage * GetSegmentationResult()
CObjectFinder * m_pObjectFinderRight
std::vector< Object2DEntry > Object2DList
Camera model and functions for a stereo camera system.
CStereoCalibration * m_pStereoCalibration
void FindObjectsInSegmentedImage(const CByteImage *const *ppImages, CByteImage **ppResultImages, ObjectColor color, int nMinPointsPerRegion, bool bShowSegmentedImage)
void AddObject(const Object2DEntry &entry)
void FindObjectsInSegmentedImage(const CByteImage *pSegmentedImage, CByteImage *pResultImage, ObjectColor color, int nMinPointsPerRegion, bool bShowSegmentedImage)
int DetermineMatches(Object2DList &resultListLeft, Object2DList &resultListRight, float fMinZDistance, float fMaxZDistance, bool bInputImagesAreRectified, bool bUseDistortionParameters, ObjectColor finalizeColor, float fMaxYDiff)
void FindObjects(const CByteImage *pImage, CByteImage *pResultImage, ObjectColor color, int nMinPointsPerRegion, bool bShowSegmentedImage)
void AddObjectClassifier(CObjectClassifierInterface *pObjectClassifier)
void PrepareImages(const CByteImage *pImage, float fROIFactor=-1, bool bCalculateHSVImage=true)
bool Init(const char *pCameraParameterFileName)
std::vector< Object3DEntry > Object3DList
void UpdateObjectFinderLists(Object2DList &resultListLeft, Object2DList &resultListRight)
CObjectFinder * m_pObjectFinderLeft
void SetRegionFilter(CRegionFilterInterface *pRegionFilter)