1 #ifndef __FINDER_PATTERN_FINDER_H__
2 #define __FINDER_PATTERN_FINDER_H__
5 * FinderPatternFinder.h
8 * Created by Christian Brunschen on 13/05/2008.
9 * Copyright 2008 ZXing authors All rights reserved.
11 * Licensed under the Apache License, Version 2.0 (the "License");
12 * you may not use this file except in compliance with the License.
13 * You may obtain a copy of the License at
15 * http://www.apache.org/licenses/LICENSE-2.0
17 * Unless required by applicable law or agreed to in writing, software
18 * distributed under the License is distributed on an "AS IS" BASIS,
19 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 * See the License for the specific language governing permissions and
21 * limitations under the License.
24 #include <zxing/qrcode/detector/FinderPattern.h>
25 #include <zxing/qrcode/detector/FinderPatternInfo.h>
26 #include <zxing/common/Counted.h>
27 #include <zxing/common/BitMatrix.h>
33 class FinderPatternFinder {
35 static int CENTER_QUORUM;
37 static int MAX_MODULES;
39 Ref<BitMatrix> image_;
40 std::vector<Ref<FinderPattern> > possibleCenters_;
43 /** stateCount must be int[5] */
44 static float centerFromEnd(int* stateCount, int end);
45 static bool foundPatternCross(int* stateCount);
47 float crossCheckVertical(size_t startI, size_t centerJ, int maxCount, int originalStateCountTotal);
48 float crossCheckHorizontal(size_t startJ, size_t centerI, int maxCount, int originalStateCountTotal);
50 /** stateCount must be int[5] */
51 bool handlePossibleCenter(int* stateCount, size_t i, size_t j);
53 bool haveMultiplyConfirmedCenters();
54 std::vector<Ref<FinderPattern> > selectBestPatterns();
55 static std::vector<Ref<FinderPattern> > orderBestPatterns(std::vector<Ref<FinderPattern> > patterns);
58 static float distance(Ref<ResultPoint> p1, Ref<ResultPoint> p2);
59 FinderPatternFinder(Ref<BitMatrix> image);
60 Ref<FinderPatternInfo> find();
65 #endif // __FINDER_PATTERN_FINDER_H__