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