1 #ifndef __DETECTOR_H__
\r
2 #define __DETECTOR_H__
\r
8 * Copyright 2010 ZXing authors All rights reserved.
\r
10 * Licensed under the Apache License, Version 2.0 (the "License");
\r
11 * you may not use this file except in compliance with the License.
\r
12 * You may obtain a copy of the License at
\r
14 * http://www.apache.org/licenses/LICENSE-2.0
\r
16 * Unless required by applicable law or agreed to in writing, software
\r
17 * distributed under the License is distributed on an "AS IS" BASIS,
\r
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
19 * See the License for the specific language governing permissions and
\r
20 * limitations under the License.
\r
23 #include <zxing/common/Counted.h>
\r
24 #include <zxing/common/DetectorResult.h>
\r
25 #include <zxing/common/BitMatrix.h>
\r
26 #include <zxing/qrcode/detector/AlignmentPattern.h>
\r
27 #include <zxing/common/PerspectiveTransform.h>
\r
28 #include <zxing/ResultPointCallback.h>
\r
36 class Detector : public Counted {
\r
38 Ref<BitMatrix> image_;
\r
39 Ref<ResultPointCallback> callback_;
\r
42 Ref<BitMatrix> getImage();
\r
44 static Ref<BitMatrix> sampleGrid(Ref<BitMatrix> image, int dimension, Ref<PerspectiveTransform>);
\r
45 static int computeDimension(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft,
\r
47 float calculateModuleSize(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft);
\r
48 float calculateModuleSizeOneWay(Ref<ResultPoint> pattern, Ref<ResultPoint> otherPattern);
\r
49 float sizeOfBlackWhiteBlackRunBothWays(int fromX, int fromY, int toX, int toY);
\r
50 float sizeOfBlackWhiteBlackRun(int fromX, int fromY, int toX, int toY);
\r
51 Ref<AlignmentPattern> findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY,
\r
52 float allowanceFactor);
\r
55 virtual Ref<PerspectiveTransform> createTransform(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref <
\r
56 ResultPoint > bottomLeft, Ref<ResultPoint> alignmentPattern, int dimension);
\r
58 Detector(Ref<BitMatrix> image);
\r
59 Ref<DetectorResult> detect(DecodeHints const& hints);
\r
64 #endif // __DETECTOR_H__
\r