ZeLianWen / Image-Registration

Image registration algorithm. Includes SIFT, SAR-SIFT,PSO-SIFT.
532 stars 126 forks source link

Sar_sift opencv 模块的match函数 #9

Open ZPH517 opened 4 years ago

ZPH517 commented 4 years ago

如下的一个LMS函数代码中,如果当match1_xy.rows等于match2_xy.rows 等于0 的时候,会在solve(A, B, values, DECOMP_QR);函数求解逆矩阵的时候报错,需在下面增加一个排除条件 if (match1_xy.rows ==0 || match2_xy.rows==0) CV_Error(Error::StsBadArg, "LMS模块输入特征点为0!");

也可以在LMS(consensus_arr1, consensus_arr2, model, rmse);进来前判定arr1和arr2的rows是否为空,如果为空则给出提示信息并直接return。

static Mat LMS(const Mat&match1_xy, const Mat &match2_xy, string model, float &rmse) { if (match1_xy.rows != match2_xy.rows) CV_Error(Error::StsBadArg, "LMS模块输入特征点对个数不一致!");

. . .

}