Added a project written on Qt framework for Symbian and added tutorials for both...
[zxing.git] / symbian / QQrDecoder / 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  *  Created by Christian Brunschen on 14/05/2008.\r
9  *  Copyright 2008 ZXing authors All rights reserved.\r
10  *\r
11  * Licensed under the Apache License, Version 2.0 (the "License");\r
12  * you may not use this file except in compliance with the License.\r
13  * You may obtain a copy of the License at\r
14  *\r
15  *      http://www.apache.org/licenses/LICENSE-2.0\r
16  *\r
17  * Unless required by applicable law or agreed to in writing, software\r
18  * distributed under the License is distributed on an "AS IS" BASIS,\r
19  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
20  * See the License for the specific language governing permissions and\r
21  * limitations under the License.\r
22  */\r
23 \r
24 #include <zxing/common/Counted.h>\r
25 #include <zxing/common/DetectorResult.h>\r
26 #include <zxing/common/BitMatrix.h>\r
27 #include <zxing/qrcode/detector/AlignmentPattern.h>\r
28 #include <zxing/common/PerspectiveTransform.h>\r
29 \r
30 namespace zxing {\r
31 namespace qrcode {\r
32 \r
33 class Detector : public Counted {\r
34 private:\r
35   Ref<BitMatrix> image_;\r
36 \r
37 protected:\r
38   Ref<BitMatrix> getImage();\r
39 \r
40   static Ref<BitMatrix> sampleGrid(Ref<BitMatrix> image, int dimension, Ref<PerspectiveTransform>);\r
41   static int computeDimension(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft,\r
42                               float moduleSize);\r
43   float calculateModuleSize(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref<ResultPoint> bottomLeft);\r
44   float calculateModuleSizeOneWay(Ref<ResultPoint> pattern, Ref<ResultPoint> otherPattern);\r
45   float sizeOfBlackWhiteBlackRunBothWays(int fromX, int fromY, int toX, int toY);\r
46   float sizeOfBlackWhiteBlackRun(int fromX, int fromY, int toX, int toY);\r
47   Ref<AlignmentPattern> findAlignmentInRegion(float overallEstModuleSize, int estAlignmentX, int estAlignmentY,\r
48       float allowanceFactor);\r
49 public:\r
50 \r
51   virtual Ref<PerspectiveTransform> createTransform(Ref<ResultPoint> topLeft, Ref<ResultPoint> topRight, Ref <\r
52       ResultPoint > bottomLeft, Ref<ResultPoint> alignmentPattern, int dimension);\r
53 \r
54   Detector(Ref<BitMatrix> image);\r
55   Ref<DetectorResult> detect();\r
56 };\r
57 }\r
58 }\r
59 \r
60 #endif // __DETECTOR_H__\r