From cb049657e5c4db8e94c14f797eef7bb8662c5450 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Tue, 2 Dec 2014 14:44:09 +0300 Subject: [PATCH] Prevent division by zero --- modules/calib3d/src/posit.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/calib3d/src/posit.cpp b/modules/calib3d/src/posit.cpp index 14c33e1e7..07baa5a3f 100644 --- a/modules/calib3d/src/posit.cpp +++ b/modules/calib3d/src/posit.cpp @@ -118,7 +118,6 @@ static CvStatus icvPOSIT( CvPOSITObject *pObject, CvPoint2D32f *imagePoints, int count = 0, converged = 0; float inorm, jnorm, invInorm, invJnorm, invScale, scale = 0, inv_Z = 0; float diff = (float)criteria.epsilon; - float inv_focalLength = 1 / focalLength; /* Check bad arguments */ if( imagePoints == NULL ) @@ -139,6 +138,7 @@ static CvStatus icvPOSIT( CvPOSITObject *pObject, CvPoint2D32f *imagePoints, return CV_BADFACTOR_ERR; /* init variables */ + float inv_focalLength = 1 / focalLength; int N = pObject->N; float *objectVectors = pObject->obj_vecs; float *invMatrix = pObject->inv_matr;