我正在使用SIFT算法进行图像匹配,并且我计算单应矩阵以了解对象与场景之间是否存在有效对应关系。方法" isValidHMatrix"下面发表的是我如何检查H矩阵是否良好,如发布in this question,我计算H矩阵中左上角2x2矩阵的行列式,如果行列式是> = 0那么它是其他好的H矩阵很糟糕。
但是当我应用这个概念来找到某些物体和场景之间的匹配时,我得到了下面发布的结果作为图像:
请让我知道如何正确检查H矩阵的有效性
结果:
for image 1: the object is part of the scene, but i got "invalid HMatrix,
det(H): -8.978588811689873"
for image 2: the object is not part of the scene, but i got "valid HMatrix,
det(H): 3.32362768456779"
for image 3: the object is not part of the scene, but i got
"goodMatchesList.size() < 4 points"
for image 4: the object is part of the scene, but i got "valid HMatrix,
det(H): 0.153917265625088"
for image 5: the object is part of the scene, but i got "valid HMatrix,
det(H): 1.0012971075010808"
for image 6: the object is part of the scene, but i got "valid HMatrix,
det(H): 0.0037162733516824488"
for image 7: the object is not part of the scene, but i got "invalid
HMatrix, det(H): -2.397038481177457E-6"
for image 8: the object is not part of the scene, but i got "valid HMatrix,
det(H): 0.0"
码:
private boolean isValidHMatrix(Mat hMatrix, String token) {
// TODO Auto-generated method stub
//double det = Core.determinant(hMatrix);
double det = Core.determinant(hMatrix.submat(new Rect (new Point(0, 0), new Point(2, 2))));
if (det >= 0) {
Log.V(TAG, "isValidHMatrix", token+"_valid HMatrix, det(H): "+det);
return true;
} else {
Log.V(TAG, "isValidHMatrix", token+"_invalid HMatrix, det(H): "+det);
return false;
}
}