diff --git a/modules/shape/src/emdL1.cpp b/modules/shape/src/emdL1.cpp index db947b528..b8381de5a 100644 --- a/modules/shape/src/emdL1.cpp +++ b/modules/shape/src/emdL1.cpp @@ -51,7 +51,7 @@ #include "precomp.hpp" #include "emdL1_def.hpp" - +#include /****************************************************************************************\ * EMDL1 Class * @@ -286,7 +286,7 @@ bool EmdL1::greedySolution2() for(r=0; r std::abs(dFlow+d1s[r+1])); // Move upward or right + bUpward = (r fabs(dFlow+d1s[r+1])); // Move upward or right // modify basic variables, record BV and related values if(bUpward) @@ -308,7 +308,7 @@ bool EmdL1::greedySolution2() d2s[c+1] += dFlow; // auxilary matrix maintanence } pBV->pParent->pChild = pBV; - pBV->flow = std::abs(dFlow); + pBV->flow = fabs(dFlow); pBV->iDir = dFlow>0; // 1:outward, 0:inward } @@ -320,7 +320,7 @@ bool EmdL1::greedySolution2() pBV = &(m_EdgesUp[r][c]); D[r+1][c] += dFlow; // auxilary matrix maintanence pBV->pParent->pChild= pBV; - pBV->flow = std::abs(dFlow); + pBV->flow = fabs(dFlow); pBV->iDir = dFlow>0; // 1:outward, 0:inward } return true; @@ -393,9 +393,9 @@ bool EmdL1::greedySolution3() //- determine which direction to move, either right or upward dFlow = D[i1][i2][i3]; - f1 = (i1<(binsDim1-1))?std::abs(dFlow+d1s[i1+1]):VHIGH; - f2 = (i2<(binsDim2-1))?std::abs(dFlow+d2s[i2+1]):VHIGH; - f3 = (i3<(binsDim3-1))?std::abs(dFlow+d3s[i3+1]):VHIGH; + f1 = (i1<(binsDim1-1))?fabs(dFlow+d1s[i1+1]):std::numeric_limits::max(); + f2 = (i2<(binsDim2-1))?fabs(dFlow+d2s[i2+1]):std::numeric_limits::max(); + f3 = (i3<(binsDim3-1))?fabs(dFlow+d3s[i3+1]):std::numeric_limits::max(); if(f1flow = std::abs(dFlow); + pBV->flow = fabs(dFlow); pBV->iDir = dFlow>0; // 1:outward, 0:inward pBV->pParent->pChild= pBV; } @@ -679,7 +679,7 @@ void EmdL1::findNewSolution() void EmdL1::findLoopFromEnterBV() { // Initialize Leaving-BV edge - float minFlow = VHIGH; + float minFlow = std::numeric_limits::max(); cvPEmdEdge pE = NULL; int iLFlag = 0; // 0: in the FROM list, 1: in the TO list diff --git a/modules/shape/src/emdL1_def.hpp b/modules/shape/src/emdL1_def.hpp index 2a75ab4d4..38f78cc3d 100644 --- a/modules/shape/src/emdL1_def.hpp +++ b/modules/shape/src/emdL1_def.hpp @@ -44,7 +44,6 @@ #include #include -#define VHIGH 1e10; /****************************************************************************************\ * For EMDL1 Framework * \****************************************************************************************/