Fixed several issues found by static analysis

This commit is contained in:
Maksim Shabunin
2017-06-28 16:26:55 +03:00
parent bbb14d3746
commit a769d69a9d
35 changed files with 113 additions and 66 deletions
+5 -6
View File
@@ -316,7 +316,7 @@ protected:
}
};
//new grouping function with using meanshift
static void groupRectangles_meanshift(std::vector<Rect>& rectList, double detectThreshold, std::vector<double>* foundWeights,
static void groupRectangles_meanshift(std::vector<Rect>& rectList, double detectThreshold, std::vector<double>& foundWeights,
std::vector<double>& scales, Size winDetSize)
{
int detectionCount = (int)rectList.size();
@@ -326,14 +326,13 @@ static void groupRectangles_meanshift(std::vector<Rect>& rectList, double detect
for (int i=0; i < detectionCount; i++)
{
hitWeights[i] = (*foundWeights)[i];
hitWeights[i] = foundWeights[i];
hitCenter = (rectList[i].tl() + rectList[i].br())*(0.5); //center of rectangles
hits[i] = Point3d(hitCenter.x, hitCenter.y, std::log(scales[i]));
}
rectList.clear();
if (foundWeights)
foundWeights->clear();
foundWeights.clear();
double logZ = std::log(1.3);
Point3d smothing(8, 16, logZ);
@@ -355,7 +354,7 @@ static void groupRectangles_meanshift(std::vector<Rect>& rectList, double detect
if (resultWeights[i] > detectThreshold)
{
rectList.push_back(resultRect);
foundWeights->push_back(resultWeights[i]);
foundWeights.push_back(resultWeights[i]);
}
}
}
@@ -387,7 +386,7 @@ void groupRectangles_meanshift(std::vector<Rect>& rectList, std::vector<double>&
{
CV_INSTRUMENT_REGION()
groupRectangles_meanshift(rectList, detectThreshold, &foundWeights, foundScales, winDetSize);
groupRectangles_meanshift(rectList, detectThreshold, foundWeights, foundScales, winDetSize);
}