fix crash when sample point out of image boundaries

Sample point goes out of image boundaries under certain circumstances. This causes crash as point is used for pointer arithmetic [here](https://github.com/mapycz/opencv/blob/4c426fe26ecbefc4568136083644d50ca1a30ac7/modules/photo/src/calibrate.cpp#L107).
Reproducible with following values:
```
images[0].cols = 12288
images[0].rows = 6144
samples = 70
```

Then `x_points = 11`,  `y_points = 6`, `step_x = 1117`, `step_y = 1024`.

Max possible `y` coordinate should be `images[0].rows - 1` but `y_points  * step_y = 6 * 1024 = 6144 = images[0].rows`.