Commit 5834bea0 authored by Gagandeep Singh's avatar Gagandeep Singh Committed by Alexander Alekhin
Browse files

Merge pull request #2385 from czgdp1807:issue-2339

Fixes error occurs in cv::ppf_match_3d::ICP::registerModelToScene()

* corrected out of range error

* remove unnecessary changes

* fix warning
parent b639795a
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -246,6 +246,7 @@ static hashtable_int* getHashtable(int* data, size_t length, int numMaxElement)
int ICP::registerModelToScene(const Mat& srcPC, const Mat& dstPC, double& residual, Matx44d& pose)
{
  int n = srcPC.rows;
  CV_CheckGT(n, 0, "");

  const bool useRobustReject = m_rejectionScale>0;

@@ -280,10 +281,7 @@ int ICP::registerModelToScene(const Mat& srcPC, const Mat& dstPC, double& residu
  // walk the pyramid
  for (int level = m_numLevels-1; level >=0; level--)
  {
    const double impact = 2;
    double div = pow((double)impact, (double)level);
    //double div2 = div*div;
    const int numSamples = cvRound((double)(n/(div)));
    const int numSamples = divUp(n, 1 << level);
    const double TolP = m_tolerance*(double)(level+1)*(level+1);
    const int MaxIterationsPyr = cvRound((double)m_maxIterations/(level+1));