Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion modules/xfeatures2d/src/affine_feature2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
{
Expand Down