bool AlignmentPatternFinder::foundPatternCross(vector<int> &stateCount) {
float maxVariance = moduleSize_ / 2.0f;
for (size_t i = 0; i < 3; i++) {
- if (labs(moduleSize_ - stateCount[i]) >= maxVariance) {
+ if (abs(moduleSize_ - stateCount[i]) >= maxVariance) {
return false;
}
}
}
int stateCountTotal = stateCount[0] + stateCount[1] + stateCount[2];
- if (5 * labs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) {
+ if (5 * abs(stateCountTotal - originalStateCountTotal) >= 2 * originalStateCountTotal) {
return NAN;
}
// Hadn't found this before; save it
tmp->retain();
possibleCenters_->push_back(tmp);
+ if (callback_ != 0) {
+ callback_->foundPossibleResultPoint(*tmp);
+ }
}
Ref<AlignmentPattern> result;
return result;
}
AlignmentPatternFinder::AlignmentPatternFinder(Ref<BitMatrix> image, size_t startX, size_t startY, size_t width,
- size_t height, float moduleSize) :
+ size_t height, float moduleSize,
+ Ref<ResultPointCallback>const& callback) :
image_(image), possibleCenters_(new vector<AlignmentPattern *> ()), startX_(startX), startY_(startY),
- width_(width), height_(height), moduleSize_(moduleSize) {
+ width_(width), height_(height), moduleSize_(moduleSize), callback_(callback) {
}
AlignmentPatternFinder::~AlignmentPatternFinder() {