C++ port: Make sure #indef/#define/#endif's and copyright information on all header...
[zxing.git] / cpp / core / src / zxing / qrcode / detector / Detector.h
1 #ifndef __DETECTOR_H__\r
2 #define __DETECTOR_H__\r
3 \r
4 /*\r
5  *  Detector.h\r
6  *  zxing\r
7  *\r
8  *  Copyright 2010 ZXing authors All rights reserved.\r
9  *\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
13  *\r
14  *      http://www.apache.org/licenses/LICENSE-2.0\r
15  *\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
21  */\r
22 \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 \r
29 namespace zxing {\r
30 namespace qrcode {\r
31 \r
32 class Detector : public Counted {\r
33 private:\r
34   Ref<BitMatrix> image_;\r
35 \r
36 protected:\r
37   Ref<BitMatrix> getImage();\r
38 \r
39   static Ref<BitMatrix> sampleGrid(Ref<BitMatrix> image, int dimension, Ref<PerspectiveTransform>);\r
40   static int computeDimension(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft,\r
41                               float moduleSize);\r
42   float calculateModuleSize(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft);\r
43   float calculateModuleSizeOneWay(Ref<ResultPoint> pattern, Ref<ResultPoint> otherPattern);\r
44   float sizeOfBlackWhiteBlackRunBothWays(int fromX, int fromY, int toX, int toY);\r
45   float sizeOfBlackWhiteBlackRun(int fromX, int fromY, int toX, int toY);\r
46   Ref<AlignmentPattern> findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY,\r
47       float allowanceFactor);\r
48 public:\r
49 \r
50   virtual Ref<PerspectiveTransform> createTransform(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref <\r
51       ResultPoint > bottomLeft, Ref<ResultPoint> alignmentPattern, int dimension);\r
52 \r
53   Detector(Ref<BitMatrix> image);\r
54   Ref<DetectorResult> detect();\r
55 };\r
56 }\r
57 }\r
58 \r
59 #endif // __DETECTOR_H__\r