c++/driveu_dataset/src/driveu_dataset.cpp
/**
 * @brief DriveuImage::mapLabelsToDisparityImage() Returns all labels of the acutal image in disparity image coordinates. Original label coordinates are first rectified and then mapped via binning factors
 * @param calib Calibration of left camera
 * */
@brief DriveuImage::mapLabelsToDisparityImage() Returns all labels of the acutal image in disparity image coordinates. Original label coordinates are first rectified and then mapped via binning factors
@param calib Calibration of left camera
@brief DriveuImage :: mapLabelsToDisparityImage () Returns all labels of the acutal image in disparity image coordinates . Original label coordinates are first rectified and then mapped via binning factors @param calib Calibration of left camera
std::vector<cv::Rect> DriveuImage::mapLabelsToDisparityImage(CalibrationData &calib) const
{
    std::vector<cv::Rect> rects_disparity;
    int binning_x = 2;
    int binning_y = 2;
    for (size_t i = 0; i < m_objects_.size(); ++i)
    {
        std::vector<cv::Point2f> distortedP, undistortedP;
        distortedP.push_back(cv::Point2f(m_objects_[i].m_x_, m_objects_[i].m_y_));
        distortedP.push_back(cv::Point2f(m_objects_[i].m_x_ + m_objects_[i].m_width_, m_objects_[i].m_y_ + m_objects_[i].m_height_));
        cv::undistortPoints(distortedP, undistortedP, calib.getIntrinsicCvMatrix(), calib.getDistortionCvMatrix(), calib.getRectificationCvMatrix(), calib.getProjectionCvMatrix());
        rects_disparity.push_back(cv::Rect(undistortedP[0].x / binning_x, undistortedP[0].y / binning_y, (undistortedP[1].x - undistortedP[0].x) / binning_x, (undistortedP[1].y - undistortedP[0].y) / binning_y));
    }
    return rects_disparity;
}
std :: vector < cv :: Rect > DriveuImage :: mapLabelsToDisparityImage ( CalibrationData & calib ) const { std :: vector < cv :: Rect > rects_disparity ; int binning_x = 2 ; int binning_y = 2 ; for ( size_t i = 0 ; i < m_objects_ . size ( ) ; ++ i ) { std :: vector < cv :: Point2f > distortedP , undistortedP ; distortedP . push_back ( cv :: Point2f ( m_objects_ [ i ] . m_x_ , m_objects_ [ i ] . m_y_ ) ) ; distortedP . push_back ( cv :: Point2f ( m_objects_ [ i ] . m_x_ + m_objects_ [ i ] . m_width_ , m_objects_ [ i ] . m_y_ + m_objects_ [ i ] . m_height_ ) ) ; cv :: undistortPoints ( distortedP , undistortedP , calib . getIntrinsicCvMatrix ( ) , calib . getDistortionCvMatrix ( ) , calib . getRectificationCvMatrix ( ) , calib . getProjectionCvMatrix ( ) ) ; rects_disparity . push_back ( cv :: Rect ( undistortedP [ 0 ] . x / binning_x , undistortedP [ 0 ] . y / binning_y , ( undistortedP [ 1 ] . x - undistortedP [ 0 ] . x ) / binning_x , ( undistortedP [ 1 ] . y - undistortedP [ 0 ] . y ) / binning_y ) ) ; } return rects_disparity ; }
@brief DriveuImage::mapLabelsToDisparityImage() Returns all labels of the acutal image in disparity image coordinates.
@brief DriveuImage :: mapLabelsToDisparityImage () Returns all labels of the acutal image in disparity image coordinates .
// binning factor: color image: 2048x1024, disparity image: 1024x440