Fixed some issues found by static analysis

This commit is contained in:
Maksim Shabunin
2017-09-05 17:10:16 +03:00
parent d25cbaaba8
commit 248e2c7d47
41 changed files with 252 additions and 218 deletions
+4 -3
View File
@@ -115,7 +115,8 @@ static CvStatus icvPOSIT( CvPOSITObject *pObject, CvPoint2D32f *imagePoints,
float* rotation, float* translation )
{
int i, j, k;
int count = 0, converged = 0;
int count = 0;
bool converged = false;
float scale = 0, inv_Z = 0;
float diff = (float)criteria.epsilon;
@@ -233,8 +234,8 @@ static CvStatus icvPOSIT( CvPOSITObject *pObject, CvPoint2D32f *imagePoints,
inv_Z = scale * inv_focalLength;
count++;
converged = ((criteria.type & CV_TERMCRIT_EPS) && (diff < criteria.epsilon));
converged |= ((criteria.type & CV_TERMCRIT_ITER) && (count == criteria.max_iter));
converged = ((criteria.type & CV_TERMCRIT_EPS) && (diff < criteria.epsilon))
|| ((criteria.type & CV_TERMCRIT_ITER) && (count == criteria.max_iter));
}
const float invScale = 1 / scale;
translation[0] = imagePoints[0].x * invScale;