31 #include <opencv2/calib3d.hpp> 
   33 #include <Calibration/Calibration.h> 
   34 #include <Calibration/Rectification.h> 
   35 #include <Calibration/StereoCalibration.h> 
   36 #include <Features/SIFTFeatures/SIFTFeatureCalculator.h> 
   37 #include <Features/SIFTFeatures/SIFTFeatureEntry.h> 
   38 #include <Image/ByteImage.h> 
   39 #include <Image/ImageProcessor.h> 
   40 #include <Image/IplImageAdaptor.h> 
   41 #include <Image/StereoMatcher.h> 
   42 #include <Math/Math3d.h> 
   43 #include <Threading/Threading.h> 
   47 #include <opencv2/opencv.hpp> 
   60     m_pSIFTFeatureCalculator = 
new CSIFTFeatureCalculator();
 
   65     m_pInterestPoints = 
new Vec2d[m_nMaxNumInterestPoints];
 
   71     delete[] m_pInterestPoints;
 
   76                                          const CByteImage* pImageRightColor,
 
   77                                          const CByteImage* pImageLeftGrey,
 
   78                                          const CByteImage* pImageRightGrey,
 
   79                                          const int nDisparityPointDistance,
 
   80                                          CStereoCalibration* pStereoCalibration,
 
   82                                          std::vector<CMSERDescriptor3D*>& aAllMSERs,
 
   83                                          std::vector<CHypothesisPoint*>& aPointsFromDepthImage,
 
   84                                          CByteImage* pDisparityImage,
 
   85                                          std::vector<Vec3d>* pAll3DPoints)
 
   88     gettimeofday(&tStart, 0);
 
   91 #pragma omp parallel sections 
  101             const int nNumFeatures =
 
  102                 ImageProcessor::CalculateHarrisInterestPoints(pImageLeftGrey,
 
  104                                                               m_nMaxNumInterestPoints,
 
  111             CStereoMatcher* stereoMatcher = 
new CStereoMatcher();
 
  112             stereoMatcher->InitCameraParameters(pStereoCalibration, 
false);
 
  119                 CDynamicArray afSIFTDescriptors(4);
 
  121 #pragma omp for schedule(static, 32) 
  123                 for (
int i = 0; i < nNumFeatures; i++)
 
  127                         Vec2d vCorrespondingPointRight;
 
  132                         int nMatchingResult = stereoMatcher->Match(pImageLeftGrey,
 
  134                                                                    (
int)m_pInterestPoints[i].
x,
 
  135                                                                    (
int)m_pInterestPoints[i].y,
 
  139                                                                    vCorrespondingPointRight,
 
  144                         if (nMatchingResult >= 0)
 
  148                                 m_pSIFTFeatureCalculator->CreateSIFTDescriptors(
 
  151                                     m_pInterestPoints[i].
x,
 
  152                                     m_pInterestPoints[i].y,
 
  157                                 if (afSIFTDescriptors.GetSize() > 0)
 
  161                                         aAllSIFTPoints.AddElement(
 
  162                                             (CSIFTFeatureEntry*)((CSIFTFeatureEntry*)
 
  163                                                                      afSIFTDescriptors[0])
 
  165                                         aAllSIFTPoints[aAllSIFTPoints.GetSize() - 1]->point3d =
 
  168                                     CSIFTFeatureEntry* pFeature =
 
  169                                         (CSIFTFeatureEntry*)afSIFTDescriptors[0];
 
  170                                     afSIFTDescriptors[0]->bDelete = 
false;
 
  171                                     afSIFTDescriptors.Clear();
 
  180             delete stereoMatcher;
 
  216 #ifdef OLP_USE_DEPTH_MAP 
  221             GetPointsFromDisparity(pImageLeftColor,
 
  226                                    nDisparityPointDistance,
 
  227                                    aPointsFromDepthImage,
 
  241     gettimeofday(&tEnd, 0);
 
  243         (1000 * tEnd.tv_sec + tEnd.tv_usec / 1000) - (1000 * tStart.tv_sec + tStart.tv_usec / 1000);
 
  244     ARMARX_VERBOSE_S << 
"Time for GetAllFeaturePoints(): " << tTimeDiff << 
" ms";
 
  248 #ifdef OLP_USE_DEPTH_MAP 
  252                                          const CByteImage* pImageLeftGrey,
 
  253                                          const pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloud,
 
  254                                          const int nDisparityPointDistance,
 
  256                                          std::vector<CMSERDescriptor3D*>& aAllMSERs,
 
  257                                          std::vector<CHypothesisPoint*>& aPointsFromDepthImage,
 
  258                                          const CCalibration* calibration)
 
  260     timeval tStart, tEnd;
 
  261     gettimeofday(&tStart, 0);
 
  262     omp_set_nested(
true);
 
  264 #pragma omp parallel sections 
  274             const int nNumFeatures =
 
  275                 ImageProcessor::CalculateHarrisInterestPoints(pImageLeftGrey,
 
  277                                                               m_nMaxNumInterestPoints,
 
  284                 CDynamicArray afSIFTDescriptors(4);
 
  286 #pragma omp for schedule(static, 32) 
  287                 for (
int i = 0; i < nNumFeatures; i++)
 
  291                         Vec3d point3D = GetCorresponding3DPoint(m_pInterestPoints[i], pointcloud);
 
  297                                 m_pSIFTFeatureCalculator->CreateSIFTDescriptors(
 
  300                                     m_pInterestPoints[i].
x,
 
  301                                     m_pInterestPoints[i].y,
 
  306                                 if (afSIFTDescriptors.GetSize() > 0)
 
  310                                         aAllSIFTPoints.AddElement(
 
  311                                             (CSIFTFeatureEntry*)((CSIFTFeatureEntry*)
 
  312                                                                      afSIFTDescriptors[0])
 
  314                                         aAllSIFTPoints[aAllSIFTPoints.GetSize() - 1]->point3d.x =
 
  316                                         aAllSIFTPoints[aAllSIFTPoints.GetSize() - 1]->point3d.y =
 
  318                                         aAllSIFTPoints[aAllSIFTPoints.GetSize() - 1]->point3d.z =
 
  321                                     CSIFTFeatureEntry* pFeature =
 
  322                                         (CSIFTFeatureEntry*)afSIFTDescriptors[0];
 
  323                                     afSIFTDescriptors[0]->bDelete = 
false;
 
  324                                     afSIFTDescriptors.Clear();
 
  344             CByteImage* pHSVImageLeft = 
new CByteImage(pImageLeftColor);
 
  345             ImageProcessor::CalculateHSVImage(pImageLeftColor, pHSVImageLeft);
 
  347             std::vector<CMSERDescriptor*> aMSERDescriptors2D;
 
  350             for (
size_t i = 0; i < aMSERDescriptors2D.size(); i++)
 
  357                 descriptor3D->
vPosition = GetCorresponding3DPoint(mean2D, pointcloud);
 
  359                 Vec2d vSigmaPoint2D, vTemp;
 
  361                 Math2d::MulVecScalar(
 
  363                 Math2d::AddVecVec(mean2D, vTemp, vSigmaPoint2D);
 
  364                 descriptor3D->
vSigmaPoint1a = GetCorresponding3DPoint(vSigmaPoint2D, pointcloud);
 
  366                 Math2d::MulVecScalar(
 
  368                 Math2d::AddVecVec(mean2D, vTemp, vSigmaPoint2D);
 
  369                 descriptor3D->
vSigmaPoint1b = GetCorresponding3DPoint(vSigmaPoint2D, pointcloud);
 
  371                 Math2d::MulVecScalar(
 
  373                 Math2d::AddVecVec(mean2D, vTemp, vSigmaPoint2D);
 
  374                 descriptor3D->
vSigmaPoint2a = GetCorresponding3DPoint(vSigmaPoint2D, pointcloud);
 
  376                 Math2d::MulVecScalar(
 
  378                 Math2d::AddVecVec(mean2D, vTemp, vSigmaPoint2D);
 
  379                 descriptor3D->
vSigmaPoint2b = GetCorresponding3DPoint(vSigmaPoint2D, pointcloud);
 
  381                 aAllMSERs.push_back(descriptor3D);
 
  394             const float fIntensityFactor = 1.0f / 255.0f;
 
  395             const size_t width = pointcloud->width;
 
  396             const size_t height = pointcloud->height;
 
  398             CByteImage* leftImageGaussFiltered = 
new CByteImage(pImageLeftColor);
 
  399             ::ImageProcessor::GaussianSmooth3x3(pImageLeftColor, leftImageGaussFiltered);
 
  401             for (
size_t i = 0; i < height; i += nDisparityPointDistance)
 
  403                 for (
size_t j = 0; j < width; j += nDisparityPointDistance)
 
  405                     const pcl::PointXYZRGBA point3D = pointcloud->at(i * width + j);
 
  414                             Vec3d vPoint3D = {point3D.x, point3D.y, point3D.z};
 
  415                             Math3d::SetVec(pNewPoint->
vPosition, vPoint3D);
 
  422                             calibration->CameraToImageCoordinates(vPoint3D, vPoint2D, 
false);
 
  423                             int u = (int)(vPoint2D.x + 0.5f);
 
  424                             int v = (int)(vPoint2D.y + 0.5f);
 
  426                                         : ((u > leftImageGaussFiltered->width - 1)
 
  427                                                ? leftImageGaussFiltered->width - 1
 
  430                                         : ((
v > leftImageGaussFiltered->height - 1)
 
  431                                                ? leftImageGaussFiltered->height - 1
 
  434                             const float weight = 1.0f;
 
  435                             r = weight * leftImageGaussFiltered
 
  436                                              ->pixels[3 * (
v * leftImageGaussFiltered->width + u)] +
 
  437                                 (1.0f - weight) * point3D.r;
 
  439                                     leftImageGaussFiltered
 
  440                                         ->pixels[3 * (
v * leftImageGaussFiltered->width + u) + 1] +
 
  441                                 (1.0f - weight) * point3D.g;
 
  443                                     leftImageGaussFiltered
 
  444                                         ->pixels[3 * (
v * leftImageGaussFiltered->width + u) + 2] +
 
  445                                 (1.0f - weight) * point3D.b;
 
  447                             const float fIntensity = (r + g + b) / 3.0f;
 
  448                             const float normalizationFactor = 1.0f / (fIntensity + 3.0f);
 
  449                             pNewPoint->
fIntensity = fIntensity * fIntensityFactor;
 
  450                             pNewPoint->
fColorR = normalizationFactor * (r + 1);
 
  451                             pNewPoint->
fColorG = normalizationFactor * (g + 1);
 
  452                             pNewPoint->
fColorB = normalizationFactor * (b + 1);
 
  454                             aPointsFromDepthImage.push_back(pNewPoint);
 
  460             delete leftImageGaussFiltered;
 
  464     gettimeofday(&tEnd, 0);
 
  466         (1000 * tEnd.tv_sec + tEnd.tv_usec / 1000) - (1000 * tStart.tv_sec + tStart.tv_usec / 1000);
 
  467     ARMARX_VERBOSE_S << 
"Time for GetAllFeaturePoints(): " << tTimeDiff << 
" ms";
 
  473 doStereoSGBM(
int minDisparity,
 
  483     int preFilterCap = 0;
 
  484     int uniquenessRatio = 0;
 
  485     int speckleWindowSize = 0;
 
  486     int speckleRange = 0;
 
  487 #if CV_MAJOR_VERSION == 2 
  489     cv::StereoSGBM stereoSGBM(minDisparity,
 
  500     stereoSGBM(leftInput, rightInput, output);
 
  502     cv::Ptr<cv::StereoSGBM> stereoSGBM = cv::StereoSGBM::create(minDisparity,
 
  512                                                                 cv::StereoSGBM::MODE_SGBM);
 
  513     stereoSGBM->compute(leftInput, rightInput, output);
 
  518 CFeatureCalculation::GetPointsFromDisparity(
const CByteImage* pImageLeftColor,
 
  519                                             const CByteImage* pImageRightColor,
 
  520                                             const CByteImage* pImageLeftGrey,
 
  521                                             const CByteImage* pImageRightGrey,
 
  522                                             CStereoCalibration* pStereoCalibration,
 
  523                                             const int nDisparityPointDistance,
 
  524                                             std::vector<CHypothesisPoint*>& aPointsFromDisparity,
 
  525                                             CByteImage* pDisparityImage,
 
  526                                             std::vector<Vec3d>* pAll3DPoints)
 
  529     CByteImage *pRectifiedImageLeftGrey, *pRectifiedImageRightGrey,
 
  530         *pRectifiedImageLeftGreyHalfsize, *pRectifiedImageRightGreyHalfsize,
 
  531         *pRectifiedImageLeftGreyQuartersize, *pRectifiedImageRightGreyQuartersize;
 
  532     IplImage *pRectifiedIplImageLeft, *pRectifiedIplImageRight, *pRectifiedIplImageLeftHalfsize,
 
  533         *pRectifiedIplImageRightHalfsize, *pRectifiedIplImageLeftQuartersize,
 
  534         *pRectifiedIplImageRightQuartersize;
 
  535     CByteImage* pRectifiedImageLeftColorGaussFiltered;
 
  536     cv::Mat mDispImg, mDispImgHalfsize, mDispImgQuartersize;
 
  537     bool bGreyImagesReady = 
false;
 
  538     bool bGreyImagesHalfsizeReady = 
false;
 
  539     bool bGreyImagesQuartersizeReady = 
false;
 
  541 #pragma omp parallel sections 
  545             const CByteImage* ppOriginalImages[2];
 
  546             ppOriginalImages[0] = pImageLeftGrey;
 
  547             ppOriginalImages[1] = pImageRightGrey;
 
  548             pRectifiedImageLeftGrey =
 
  550             pRectifiedImageRightGrey =
 
  552             CByteImage* ppRectifiedImages[2];
 
  553             ppRectifiedImages[0] = pRectifiedImageLeftGrey;
 
  554             ppRectifiedImages[1] = pRectifiedImageRightGrey;
 
  556             CRectification* pRectification = 
new CRectification(
true, 
false);
 
  557             pRectification->Init(pStereoCalibration);
 
  558             pRectification->Rectify(ppOriginalImages, ppRectifiedImages);
 
  560             pRectifiedIplImageLeft = IplImageAdaptor::Adapt(pRectifiedImageLeftGrey);
 
  561             pRectifiedIplImageRight = IplImageAdaptor::Adapt(pRectifiedImageRightGrey);
 
  562             bGreyImagesReady = 
true;
 
  565             pRectifiedImageLeftGreyHalfsize =
 
  567             pRectifiedImageRightGreyHalfsize =
 
  569             ImageProcessor::Resize(pRectifiedImageLeftGrey, pRectifiedImageLeftGreyHalfsize);
 
  570             ImageProcessor::Resize(pRectifiedImageRightGrey, pRectifiedImageRightGreyHalfsize);
 
  572             pRectifiedIplImageLeftHalfsize =
 
  573                 IplImageAdaptor::Adapt(pRectifiedImageLeftGreyHalfsize);
 
  574             pRectifiedIplImageRightHalfsize =
 
  575                 IplImageAdaptor::Adapt(pRectifiedImageRightGreyHalfsize);
 
  576             bGreyImagesHalfsizeReady = 
true;
 
  579             pRectifiedImageLeftGreyQuartersize =
 
  581             pRectifiedImageRightGreyQuartersize =
 
  583             ImageProcessor::Resize(pRectifiedImageLeftGrey, pRectifiedImageLeftGreyQuartersize);
 
  584             ImageProcessor::Resize(pRectifiedImageRightGrey, pRectifiedImageRightGreyQuartersize);
 
  586             pRectifiedIplImageLeftQuartersize =
 
  587                 IplImageAdaptor::Adapt(pRectifiedImageLeftGreyQuartersize);
 
  588             pRectifiedIplImageRightQuartersize =
 
  589                 IplImageAdaptor::Adapt(pRectifiedImageRightGreyQuartersize);
 
  590             bGreyImagesQuartersizeReady = 
true;
 
  592             delete pRectification;
 
  597             const CByteImage* ppOriginalImages[2];
 
  598             ppOriginalImages[0] = pImageLeftColor;
 
  599             ppOriginalImages[1] = pImageRightColor;
 
  600             CByteImage* pRectifiedImageLeftColor =
 
  602             CByteImage* pRectifiedImageRightColor =
 
  604             CByteImage* ppRectifiedImages[2];
 
  605             ppRectifiedImages[0] = pRectifiedImageLeftColor;
 
  606             ppRectifiedImages[1] = pRectifiedImageRightColor;
 
  608             CRectification* pRectification = 
new CRectification(
true, 
false);
 
  609             pRectification->Init(pStereoCalibration);
 
  610             pRectification->Rectify(ppOriginalImages, ppRectifiedImages);
 
  612             pRectifiedImageLeftColorGaussFiltered =
 
  614             ImageProcessor::GaussianSmooth3x3(pRectifiedImageLeftColor,
 
  615                                               pRectifiedImageLeftColorGaussFiltered);
 
  617             delete pRectifiedImageLeftColor;
 
  618             delete pRectifiedImageRightColor;
 
  619             delete pRectification;
 
  627             while (!bGreyImagesReady)
 
  629                 Threading::YieldThread();
 
  646             const cv::Mat mLeftImg = cv::cvarrToMat(pRectifiedIplImageLeft);
 
  647             const cv::Mat mRightImg = cv::cvarrToMat(pRectifiedIplImageRight);
 
  648             const int nSADWindowSize = 7; 
 
  649             const int nPenaltyDispDiffOne = 8 * 3 * nSADWindowSize * nSADWindowSize; 
 
  650             const int nPenaltyDispDiffBiggerOne = 32 * 3 * nSADWindowSize * nSADWindowSize; 
 
  656                          nPenaltyDispDiffBiggerOne,
 
  666             while (!bGreyImagesHalfsizeReady)
 
  668                 Threading::YieldThread();
 
  671             const cv::Mat mLeftImg = cv::cvarrToMat(pRectifiedIplImageLeftHalfsize);
 
  672             const cv::Mat mRightImg = cv::cvarrToMat(pRectifiedIplImageRightHalfsize);
 
  673             const int nSADWindowSize = 7;
 
  674             const int nPenaltyDispDiffOne = 8 * 3 * nSADWindowSize * nSADWindowSize; 
 
  675             const int nPenaltyDispDiffBiggerOne = 32 * 3 * nSADWindowSize * nSADWindowSize; 
 
  681                          nPenaltyDispDiffBiggerOne,
 
  691             while (!bGreyImagesQuartersizeReady)
 
  693                 Threading::YieldThread();
 
  696             const cv::Mat mLeftImg = cv::cvarrToMat(pRectifiedIplImageLeftQuartersize);
 
  697             const cv::Mat mRightImg = cv::cvarrToMat(pRectifiedIplImageRightQuartersize);
 
  698             const int nSADWindowSize = 7;
 
  699             const int nPenaltyDispDiffOne = 8 * 3 * nSADWindowSize * nSADWindowSize; 
 
  700             const int nPenaltyDispDiffBiggerOne = 32 * 3 * nSADWindowSize * nSADWindowSize; 
 
  706                          nPenaltyDispDiffBiggerOne,
 
  715     CStereoMatcher* pStereoMatcher = 
new CStereoMatcher();
 
  716     CStereoCalibration* pStereoCalibrationCopy = 
new CStereoCalibration(*pStereoCalibration);
 
  717     pStereoMatcher->InitCameraParameters(pStereoCalibrationCopy, 
false);
 
  718     const int nDispMin = pStereoMatcher->GetDisparityEstimate(4000);
 
  719     const int nDispMax = pStereoMatcher->GetDisparityEstimate(200);
 
  720     Vec2d vImgPointLeft, vImgPointRight;
 
  722     const float fIntensityFactor = 1.0f / (3 * 255);
 
  727 #pragma omp parallel for schedule(static, 80) 
  732             int nDispFullsize = mDispImg.at<
short>(i, j) / 16;
 
  733             int nDispHalfsize = 2 * mDispImgHalfsize.at<
short>(i / 2, j / 2) / 16;
 
  734             int nDispQuartersize = 4 * mDispImgQuartersize.at<
short>(i / 4, j / 4) / 16;
 
  738             int nNumValidDisparities = 0;
 
  740             if ((nDispFullsize > nDispMin) && (nDispFullsize < nDispMax))
 
  742                 nDisp += nDispFullsize;
 
  743                 nNumValidDisparities++;
 
  746             if ((nDispHalfsize > nDispMin) && (nDispHalfsize < nDispMax))
 
  748                 nDisp += nDispHalfsize;
 
  749                 nNumValidDisparities++;
 
  752             if ((nDispQuartersize > nDispMin) && (nDispQuartersize < nDispMax))
 
  754                 nDisp += nDispQuartersize;
 
  755                 nNumValidDisparities++;
 
  758             if (nNumValidDisparities > 0)
 
  760                 fDisp = (
float)nDisp / (
float)nNumValidDisparities;
 
  775             pDisparitiesCopy[i] = pDisparities[i];
 
  778         const int nMargin = 10;
 
  779         const int nHoleFillingAveragingRadius = 5;
 
  788                     int nNumValidDisparities = 0;
 
  790                     for (
int k = -nHoleFillingAveragingRadius; k <= nHoleFillingAveragingRadius;
 
  793                         for (
int l = -nHoleFillingAveragingRadius; l <= nHoleFillingAveragingRadius;
 
  799                                 nNumValidDisparities++;
 
  804                     if (nNumValidDisparities > 0)
 
  806                         pDisparities[i * 
OLP_IMG_WIDTH + j] = nSum / nNumValidDisparities;
 
  815     CByteImage* pRectifiedDisparityImage =
 
  823             pRectifiedDisparityImage->pixels[i * 
OLP_IMG_WIDTH + j] = (nDisp > 255) ? 255 : nDisp;
 
  828     ImageProcessor::Zero(pDisparityImage);
 
  829     Vec2d vRectPos, vUnRectPos;
 
  830     Mat3d mRectificationHomography = pStereoCalibration->rectificationHomographyLeft;
 
  838             Math2d::ApplyHomography(mRectificationHomography, vRectPos, vUnRectPos);
 
  840             if (0 <= vUnRectPos.y && vUnRectPos.y < 
OLP_IMG_HEIGHT && 0 <= vUnRectPos.x &&
 
  843                 pDisparityImage->pixels[(int)vUnRectPos.y * 
OLP_IMG_WIDTH + (
int)vUnRectPos.x] =
 
  851     delete pRectifiedDisparityImage;
 
  864 #pragma omp parallel sections 
  868                 CalculateSmoothedDisparityImage(pDisparities, pSmoothedDisparity1, 0);
 
  873                 CalculateSmoothedDisparityImage(pDisparities, pSmoothedDisparity2, 1);
 
  878                 CalculateSmoothedDisparityImage(pDisparities, pSmoothedDisparity3, 2);
 
  883                 CalculateSmoothedDisparityImage(pDisparities, pSmoothedDisparity4, 4);
 
  889             pSmoothedDisparity[i] = 0.25f * (pSmoothedDisparity1[i] + pSmoothedDisparity2[i] +
 
  890                                              pSmoothedDisparity3[i] + pSmoothedDisparity4[i]);
 
  893         delete[] pSmoothedDisparity1;
 
  894         delete[] pSmoothedDisparity2;
 
  895         delete[] pSmoothedDisparity3;
 
  896         delete[] pSmoothedDisparity4;
 
  902             pSmoothedDisparity[i] = pDisparities[i];
 
  907     const float fDispMin = nDispMin;
 
  908     const float fDispMax = nDispMax;
 
  909     CDynamicArray afSIFTDescriptors(4);
 
  913         for (
int j = 0; j < 
OLP_IMG_WIDTH; j += nDisparityPointDistance)
 
  918             if ((fDisp > fDispMin) && (fDisp < fDispMax))
 
  923                 vImgPointRight.x = j - fDisp;
 
  924                 vImgPointRight.y = i;
 
  926                 pStereoCalibration->Calculate3DPoint(
 
  927                     vImgPointLeft, vImgPointRight, vPoint3D, 
true, 
false);
 
  935                     Math3d::SetVec(pNewPoint->
vPosition, vPoint3D);
 
  940                     const float fIntensity =
 
  941                         pRectifiedImageLeftColorGaussFiltered->pixels[3 * (i * 
OLP_IMG_WIDTH + j)] +
 
  942                         pRectifiedImageLeftColorGaussFiltered
 
  944                         pRectifiedImageLeftColorGaussFiltered
 
  947                     pNewPoint->
fIntensity = (fIntensity - 3) * fIntensityFactor;
 
  948                     pNewPoint->
fColorR = (pRectifiedImageLeftColorGaussFiltered
 
  952                     pNewPoint->
fColorG = (pRectifiedImageLeftColorGaussFiltered
 
  956                     pNewPoint->
fColorB = (pRectifiedImageLeftColorGaussFiltered
 
  962                     m_pSIFTFeatureCalculator->CreateSIFTDescriptors(
 
  963                         pRectifiedImageLeftGrey, &afSIFTDescriptors, j, i, 1.0f, 
false, 
false);
 
  965                     if (afSIFTDescriptors.GetSize() > 0)
 
  968                             (CSIFTFeatureEntry*)((CSIFTFeatureEntry*)afSIFTDescriptors[0])
 
  972                         CSIFTFeatureEntry* pFeature = (CSIFTFeatureEntry*)afSIFTDescriptors[0];
 
  973                         afSIFTDescriptors[0]->bDelete = 
false;
 
  974                         afSIFTDescriptors.Clear();
 
  978                     aPointsFromDisparity.push_back(pNewPoint);
 
  992             for (
int j = 0; j < 
OLP_IMG_WIDTH; j += nDisparityPointDistance)
 
  997                 vImgPointRight.x = j - fDisp;
 
  998                 vImgPointRight.y = i;
 
  999                 pStereoCalibration->Calculate3DPoint(
 
 1000                     vImgPointLeft, vImgPointRight, vPoint3D, 
true, 
false);
 
 1004                     if (aPointsFromDisparity.size() > 0)
 
 1006                         Math3d::SetVec(vPoint3D, aPointsFromDisparity.at(0)->vPosition);
 
 1010                 pAll3DPoints->push_back(vPoint3D);
 
 1016     delete pRectifiedImageLeftGrey;
 
 1017     delete pRectifiedImageRightGrey;
 
 1018     delete pRectifiedImageLeftGreyHalfsize;
 
 1019     delete pRectifiedImageRightGreyHalfsize;
 
 1020     delete pRectifiedImageLeftGreyQuartersize;
 
 1021     delete pRectifiedImageRightGreyQuartersize;
 
 1022     delete pRectifiedImageLeftColorGaussFiltered;
 
 1023     delete pStereoMatcher;
 
 1024     delete pStereoCalibrationCopy;
 
 1025     cvReleaseImageHeader(&pRectifiedIplImageLeft);
 
 1026     cvReleaseImageHeader(&pRectifiedIplImageRight);
 
 1027     delete[] pSmoothedDisparity;
 
 1031 CFeatureCalculation::CalculateSmoothedDisparityImage(
float* pInputDisparity,
 
 1032                                                      float* pSmoothedDisparity,
 
 1037         pSmoothedDisparity[i] = pInputDisparity[i];
 
 1046             if (pInputDisparity[nIndex] != 0)
 
 1051                 for (
int l = -nRadius; l <= nRadius; l++)
 
 1053                     for (
int k = -nRadius; k <= nRadius; k++)
 
 1057                         if (pInputDisparity[nTempIndex] != 0)
 
 1059                             fSum += pInputDisparity[nTempIndex];
 
 1065                 pSmoothedDisparity[nIndex] = fSum / (
float)nNumPixels;
 
 1072 CFeatureCalculation::GetCorresponding3DPoint(
 
 1073     const Vec2d point2D,
 
 1074     const pcl::PointCloud<pcl::PointXYZRGBA>::Ptr pointcloud)
 
 1077     const int width = pointcloud->width;
 
 1078     const int height = pointcloud->height;
 
 1079     const int x = (point2D.x < 0) ? 0 : ((point2D.x > width - 1) ? width - 1 : point2D.x);
 
 1080     const int y = (point2D.y < 0) ? 0 : ((point2D.y > height - 1) ? height - 1 : point2D.y);
 
 1081     const int index = y * width + 
x;
 
 1082     pcl::PointXYZRGBA point3D = pointcloud->at(
index);
 
 1083     result.x = point3D.x;
 
 1084     result.y = point3D.y;
 
 1085     result.z = point3D.z;