diff --git a/modules/photo/src/calibrate.cpp b/modules/photo/src/calibrate.cpp index eda3e1265bbc2ff24038a25322d8de77c7117281..63f1818e47815c9495c88797d1551bd84350de45 100644 --- a/modules/photo/src/calibrate.cpp +++ b/modules/photo/src/calibrate.cpp @@ -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)); } } }