Merge pull request #1463 from Sahloul:affine_feature2d

pull/1452/head
Alexander Alekhin 7 years ago
commit d47288db32
  1. 7
      modules/xfeatures2d/src/affine_feature2d.cpp

@ -170,6 +170,10 @@ bool calcAffineAdaptation(const Mat & fimage, Elliptic_KeyPoint & keypoint)
//Differentation scale selection
selDifferentiationScale(warpedImg, Lxm2smooth, Lxmysmooth, Lym2smooth, si,
Point(cx, cy));
if (Lym2smooth.empty()) {
divergence = true;
continue;
}
//Spatial Localization
cxPr = cx; //Previous iteration point in normalized window
@ -428,7 +432,8 @@ float selDifferentiationScale(const Mat & img, Mat & Lxm2smooth, Mat & Lxmysmoot
eigen(M, eval);
double eval1 = std::abs(eval.at<float> (0, 0));
double eval2 = std::abs(eval.at<float> (1, 0));
double q = min(eval1, eval2) / max(eval1, eval2);
double m = max(eval1, eval2);
double q = (m == 0) ? -1 : min(eval1, eval2) / m;
if (q >= qMax)
{

Loading…
Cancel
Save