added extra check in CalibrateDebevec to make sure the points are within the image:
authorVadim Pisarevsky <vadim.pisarevsky@gmail.com>
Thu, 14 May 2015 16:54:48 +0000 (19:54 +0300)
committerVadim Pisarevsky <vadim.pisarevsky@gmail.com>
Thu, 14 May 2015 16:54:48 +0000 (19:54 +0300)
http://code.opencv.org/issues/4124

modules/photo/src/calibrate.cpp

index eda3e12..63f1818 100644 (file)
@@ -90,7 +90,9 @@ public:
 
             for(int i = 0, x = step_x / 2; i < x_points; i++, x += step_x) {
                 for(int j = 0, y = step_y / 2; j < y_points; j++, y += step_y) {
-                    sample_points.push_back(Point(x, y));
+                    if( 0 <= x && x < images[0].cols &&
+                        0 <= y && y < images[0].rows )
+                        sample_points.push_back(Point(x, y));
                 }
             }
         }