Commit cb049657 authored by Dmitry-Me's avatar Dmitry-Me

Prevent division by zero

parent be5c9103
...@@ -118,7 +118,6 @@ static CvStatus icvPOSIT( CvPOSITObject *pObject, CvPoint2D32f *imagePoints, ...@@ -118,7 +118,6 @@ static CvStatus icvPOSIT( CvPOSITObject *pObject, CvPoint2D32f *imagePoints,
int count = 0, converged = 0; int count = 0, converged = 0;
float inorm, jnorm, invInorm, invJnorm, invScale, scale = 0, inv_Z = 0; float inorm, jnorm, invInorm, invJnorm, invScale, scale = 0, inv_Z = 0;
float diff = (float)criteria.epsilon; float diff = (float)criteria.epsilon;
float inv_focalLength = 1 / focalLength;
/* Check bad arguments */ /* Check bad arguments */
if( imagePoints == NULL ) if( imagePoints == NULL )
...@@ -139,6 +138,7 @@ static CvStatus icvPOSIT( CvPOSITObject *pObject, CvPoint2D32f *imagePoints, ...@@ -139,6 +138,7 @@ static CvStatus icvPOSIT( CvPOSITObject *pObject, CvPoint2D32f *imagePoints,
return CV_BADFACTOR_ERR; return CV_BADFACTOR_ERR;
/* init variables */ /* init variables */
float inv_focalLength = 1 / focalLength;
int N = pObject->N; int N = pObject->N;
float *objectVectors = pObject->obj_vecs; float *objectVectors = pObject->obj_vecs;
float *invMatrix = pObject->inv_matr; float *invMatrix = pObject->inv_matr;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment