71         m_bOwnCalibration = 
true;
 
   73         m_pObjectEntryFilter = 0;
 
   92         if(!m_bOwnCalibration)
 
   95         m_bOwnCalibration = 
true;
 
  102         if (m_bOwnCalibration)
 
  105         m_bOwnCalibration = 
false;
 
  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;
 
  257                                 (!m_pObjectEntryFilter || m_pObjectEntryFilter->
CheckEntry(objectEntry)))
 
  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";
 
  320                                 if (!m_pObjectEntryFilter || m_pObjectEntryFilter->
CheckEntry(entry))
 
  331         for (i = 0; i < (int) m_objectClassifierList.size(); i++)
 
  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;
 
  409         m_objectClassifierList.push_back(pObjectClassifier);
 
  414         for (std::vector<CObjectClassifierInterface*>::iterator it = m_objectClassifierList.begin(); it != m_objectClassifierList.end(); it++)
 
  416                 if (*it == pObjectClassifier)
 
  418                         m_objectClassifierList.erase(it);
 
  426         m_objectClassifierList.clear();
 
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...
void SetRegionFilter(CRegionFilterInterface *pRegionFilter)
void UpdateObjectFinderLists(Object2DList &resultListLeft, Object2DList &resultListRight)
void AddObjectClassifier(CObjectClassifierInterface *pObjectClassifier)
CByteImage * GetLeftSegmentationResult()
void SetRegionFilter(CRegionFilterInterface *pRegionFilter)
void SetColorParameterSet(const CColorParameterSet *pColorParameterSet)
void FindObjectsInSegmentedImage(const CByteImage *const *ppImages, CByteImage **ppResultImages, ObjectColor color, int nMinPointsPerRegion, bool bShowSegmentedImage)
bool LoadCameraParameters(const char *pCameraParameterFileName, bool bTransformLeftCameraToIdentity=true)
Initializes the stereo camera model, given a file path to a stereo camera parameter file...
void FindObjects(const CByteImage *pImage, CByteImage *pResultImage, ObjectColor color, int nMinPointsPerRegion, bool bShowSegmentedImage)
CObjectFinder * m_pObjectFinderRight
float CalculateEpipolarLineInLeftImageDistance(const Vec2d &pointInLeftImage, const Vec2d &pointInRightImage)
Given a point correspondence, computes the distance from the epipolar line in the left image...
void AddObject(const Object3DEntry &entry)
Object3DList m_objectList
void SetColorParameterSet(const CColorParameterSet *pColorParameterSet)
int DetermineMatches(Object2DList &resultListLeft, Object2DList &resultListRight, float fMinZDistance, float fMaxZDistance, bool bInputImagesAreRectified, bool bUseDistortionParameters, ObjectColor finalizeColor, float fMaxYDiff)
void PrepareImages(const CByteImage *pImage, float fROIFactor=-1, bool bCalculateHSVImage=true)
std::vector< Object2DEntry > Object2DList
CStereoCalibration * m_pStereoCalibration
void FindObjectsInSegmentedImage(const CByteImage *pSegmentedImage, CByteImage *pResultImage, ObjectColor color, int nMinPointsPerRegion, bool bShowSegmentedImage)
Object2DList m_objectList
Data structure for the representation of a 3D vector. 
void RemoveObjectClassifier(CObjectClassifierInterface *pObjectClassifier)
void ClearObjectClassifierList()
void FindObjects(const CByteImage *const *ppImages, CByteImage **ppResultImages, ObjectColor color, int nMinPointsPerRegion, bool bShowSegmentedImage)
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 ...
virtual bool CheckEntry(const Object3DEntry &entry)=0
CByteImage * GetSegmentationResult()
bool Init(const char *pCameraParameterFileName)
Camera model and functions for a stereo camera system. 
void AddObject(const Object2DEntry &entry)
void SetVec(Vec3d &vec, float x, float y, float z)
void PrepareImages(const CByteImage *const *ppImages, float fROIFactor=-1, bool bCalculateHSVImage=true)