1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Fix out of bounds in calibrateAndNormalizePointsPnP

ipoints can have 3 or 4 points.
This commit is contained in:
Vincent Rabaud
2025-11-13 11:14:39 +01:00
parent 8f0c9ffe90
commit 49fc1dd796
+1 -1
View File
@@ -173,7 +173,7 @@ void p3p::calibrateAndNormalizePointsPnP(const Mat &opoints_, const Mat &ipoints
Mat ipoints;
convertPoints(ipoints_, ipoints, 2);
for (int i = 0; i < ipoints.rows; i++) {
for (int i = 0; i < 3; i++) {
const double k_inv_u = ipoints.at<double>(i, 0);
const double k_inv_v = ipoints.at<double>(i, 1);
double x_norm = 1.0 / sqrt(k_inv_u*k_inv_u + k_inv_v*k_inv_v + 1);