use correct vector size after possible erases

git-svn-id: https://zxing.googlecode.com/svn/trunk@1817 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
smparkes@smparkes.net 2011-06-09 20:00:14 +00:00
parent 308cb7096a
commit f17a43df81

View file

@ -343,11 +343,11 @@ vector<Ref<FinderPattern> > FinderPatternFinder::selectBestPatterns() {
if (possibleCenters_.size() > 3) {
// Throw away all but those first size candidate points we found.
float totalModuleSize = 0.0f;
for (size_t i = 0; i < startSize; i++) {
for (size_t i = 0; i < possibleCenters_.size(); i++) {
float size = possibleCenters_[i]->getEstimatedModuleSize();
totalModuleSize += size;
}
float average = totalModuleSize / (float) startSize;
float average = totalModuleSize / (float) possibleCenters_.size();
sort(possibleCenters_.begin(), possibleCenters_.end(), CenterComparator(average));
}