fixed bug in opencv_stitching (added handling of homography evaluation failure)
authorAlexey Spizhevoy <no@email>
Tue, 16 Aug 2011 09:51:54 +0000 (09:51 +0000)
committerAlexey Spizhevoy <no@email>
Tue, 16 Aug 2011 09:51:54 +0000 (09:51 +0000)
modules/stitching/main.cpp
modules/stitching/matchers.cpp

index ea4b331..d465229 100644 (file)
@@ -549,6 +549,7 @@ int main(int argc, char* argv[])
                     sz.width = cvRound(full_img_sizes[i].width * compose_scale);\r
                     sz.height = cvRound(full_img_sizes[i].height * compose_scale);\r
                 }\r
+\r
                 Rect roi = warper->warpRoi(sz, static_cast<float>(cameras[i].focal), cameras[i].R);\r
                 corners[i] = roi.tl();\r
                 sizes[i] = roi.size();\r
index b043886..6365c2b 100644 (file)
@@ -465,6 +465,8 @@ void BestOf2NearestMatcher::match(const ImageFeatures &features1, const ImageFea
 \r
     // Find pair-wise motion\r
     matches_info.H = findHomography(src_points, dst_points, matches_info.inliers_mask, CV_RANSAC);\r
+    if (abs(determinant(matches_info.H)) < numeric_limits<double>::epsilon())\r
+        return;\r
 \r
     // Find number of inliers\r
     matches_info.num_inliers = 0;\r