8 * Created by Christian Brunschen on 14/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 "../../common/Counted.h"
25 #include "../../common/DetectorResult.h"
26 #include "../../MonochromeBitmapSource.h"
27 #include "AlignmentPattern.h"
33 using namespace common;
35 class Detector : public Counted {
37 Ref<MonochromeBitmapSource> image_;
38 static Ref<BitMatrix> sampleGrid(Ref<MonochromeBitmapSource> image,
39 Ref<ResultPoint> topLeft,
40 Ref<ResultPoint> topRight,
41 Ref<ResultPoint> bottomLeft,
42 Ref<ResultPoint> alignmentPattern,
44 static int computeDimension(Ref<ResultPoint> topLeft,
45 Ref<ResultPoint> topRight,
46 Ref<ResultPoint> bottomLeft,
48 float calculateModuleSize(Ref<ResultPoint> topLeft,
49 Ref<ResultPoint> topRight,
50 Ref<ResultPoint> bottomLeft);
51 float calculateModuleSizeOneWay(Ref<ResultPoint> pattern,
52 Ref<ResultPoint> otherPattern);
53 float sizeOfBlackWhiteBlackRunBothWays(int fromX, int fromY,
55 float sizeOfBlackWhiteBlackRun(int fromX, int fromY,
57 Ref<AlignmentPattern> findAlignmentInRegion(float overallEstModuleSize,
60 float allowanceFactor);
62 Detector(Ref<MonochromeBitmapSource> image);
63 Ref<DetectorResult> detect();
68 #endif // __DETECTOR_H__