OLD | NEW |
---|---|
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FXBARCODE_COMMON_BC_WHITERECTANGLEDETECTOR_H_ | 7 #ifndef XFA_FXBARCODE_COMMON_BC_WHITERECTANGLEDETECTOR_H_ |
8 #define XFA_FXBARCODE_COMMON_BC_WHITERECTANGLEDETECTOR_H_ | 8 #define XFA_FXBARCODE_COMMON_BC_WHITERECTANGLEDETECTOR_H_ |
9 | 9 |
10 #include "core/fxcrt/include/fx_basic.h" | 10 #include "core/fxcrt/include/fx_basic.h" |
11 | 11 |
12 class CBC_CommonBitMatrix; | 12 class CBC_CommonBitMatrix; |
13 class CBC_ResultPoint; | 13 class CBC_ResultPoint; |
14 | 14 |
15 class CBC_WhiteRectangleDetector { | 15 class CBC_WhiteRectangleDetector { |
16 public: | 16 public: |
17 CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image); | 17 explicit CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image); |
18 CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image, | 18 CBC_WhiteRectangleDetector(CBC_CommonBitMatrix* image, |
19 int32_t initSize, | 19 int32_t initSize, |
20 int32_t x, | 20 int32_t x, |
21 int32_t y); | 21 int32_t y); |
22 virtual ~CBC_WhiteRectangleDetector(); | 22 virtual ~CBC_WhiteRectangleDetector(); |
23 | |
23 virtual void Init(int32_t& e); | 24 virtual void Init(int32_t& e); |
24 | 25 |
25 CFX_ArrayTemplate<CBC_ResultPoint*>* Detect(int32_t& e); | 26 CFX_ArrayTemplate<CBC_ResultPoint*>* Detect(int32_t& e); |
27 int32_t Round(FX_FLOAT d); | |
Lei Zhang
2016/06/15 00:04:30
Not obvious why this needs to be public.
Wei Li
2016/06/15 00:32:39
Done.
| |
26 | 28 |
27 private: | 29 private: |
28 int32_t Round(float d); | |
29 CBC_ResultPoint* GetBlackPointOnSegment(FX_FLOAT aX, | 30 CBC_ResultPoint* GetBlackPointOnSegment(FX_FLOAT aX, |
30 FX_FLOAT aY, | 31 FX_FLOAT aY, |
31 FX_FLOAT bX, | 32 FX_FLOAT bX, |
32 FX_FLOAT bY); | 33 FX_FLOAT bY); |
33 int32_t DistanceL2(FX_FLOAT aX, FX_FLOAT aY, FX_FLOAT bX, FX_FLOAT bY); | 34 int32_t DistanceL2(FX_FLOAT aX, FX_FLOAT aY, FX_FLOAT bX, FX_FLOAT bY); |
34 CFX_ArrayTemplate<CBC_ResultPoint*>* CenterEdges(CBC_ResultPoint* y, | 35 CFX_ArrayTemplate<CBC_ResultPoint*>* CenterEdges(CBC_ResultPoint* y, |
35 CBC_ResultPoint* z, | 36 CBC_ResultPoint* z, |
36 CBC_ResultPoint* x, | 37 CBC_ResultPoint* x, |
37 CBC_ResultPoint* t) const; | 38 CBC_ResultPoint* t) const; |
38 | 39 |
39 FX_BOOL ContainsBlackPoint(int32_t a, | 40 FX_BOOL ContainsBlackPoint(int32_t a, |
40 int32_t b, | 41 int32_t b, |
41 int32_t fixed, | 42 int32_t fixed, |
42 FX_BOOL horizontal); | 43 FX_BOOL horizontal); |
43 | 44 |
44 static const int32_t INIT_SIZE = 30; | 45 static const int32_t INIT_SIZE = 30; |
45 static const int32_t CORR = 1; | 46 static const int32_t CORR = 1; |
46 | 47 |
47 CBC_CommonBitMatrix* m_image; | 48 CBC_CommonBitMatrix* m_image; |
48 int32_t m_height; | 49 int32_t m_height; |
49 int32_t m_width; | 50 int32_t m_width; |
50 int32_t m_leftInit; | 51 int32_t m_leftInit; |
51 int32_t m_rightInit; | 52 int32_t m_rightInit; |
52 int32_t m_downInit; | 53 int32_t m_downInit; |
53 int32_t m_upInit; | 54 int32_t m_upInit; |
54 }; | 55 }; |
55 | 56 |
56 #endif // XFA_FXBARCODE_COMMON_BC_WHITERECTANGLEDETECTOR_H_ | 57 #endif // XFA_FXBARCODE_COMMON_BC_WHITERECTANGLEDETECTOR_H_ |
OLD | NEW |