Image Component Library (ICL)
BCHCode.h
Go to the documentation of this file.
1 /********************************************************************
2 ** Image Component Library (ICL) **
3 ** **
4 ** Copyright (C) 2006-2013 CITEC, University of Bielefeld **
5 ** Neuroinformatics Group **
6 ** Website: www.iclcv.org and **
7 ** http://opensource.cit-ec.de/projects/icl **
8 ** **
9 ** File : ICLMarkers/src/ICLMarkers/BCHCode.h **
10 ** Module : ICLMarkers **
11 ** Authors: Christof Elbrechter **
12 ** **
13 ** **
14 ** GNU LESSER GENERAL PUBLIC LICENSE **
15 ** This file may be used under the terms of the GNU Lesser General **
16 ** Public License version 3.0 as published by the **
17 ** **
18 ** Free Software Foundation and appearing in the file LICENSE.LGPL **
19 ** included in the packaging of this file. Please review the **
20 ** following information to ensure the license requirements will **
21 ** be met: http://www.gnu.org/licenses/lgpl-3.0.txt **
22 ** **
23 ** The development of this software was supported by the **
24 ** Excellence Cluster EXC 277 Cognitive Interaction Technology. **
25 ** The Excellence Cluster EXC 277 is a grant of the Deutsche **
26 ** Forschungsgemeinschaft (DFG) in the context of the German **
27 ** Excellence Initiative. **
28 ** **
29 ********************************************************************/
30 
31 #pragma once
32 
33 #include <ICLUtils/CompatMacros.h>
34 #include <ICLUtils/BasicTypes.h>
35 #include <ICLUtils/Uncopyable.h>
36 #include <ICLCore/Img.h>
37 #include <bitset>
38 
39 namespace icl{
40  namespace markers{
41 
43  typedef std::bitset<36> BCHCode;
44 
46  typedef std::bitset<4096> BCHCodeSubSet;
47 
52  int id;
53  int errors;
54 
56  operator bool() const { return id >= 0; }
57 
59  bool operator<(const DecodedBCHCode &c){
60  return errors < c.errors;
61  }
62  };
63 
69  };
70 
72  ICLMarkers_API std::ostream &operator<<(std::ostream &s, const DecodedBCHCode2D::Rotation &r);
73 
75 
77  class Impl;
78  Impl *impl;
79 
80  public:
82  BCHCoder();
83 
85  ~BCHCoder();
86 
88  static BCHCode encode(int idx);
89 
91 
98  static core::Img8u createMarkerImage(int idx, int border=2, const utils::Size &resultSize=utils::Size::null);
99 
101  static BCHCode rotateCode(const BCHCode &in);
102 
103 
128  DecodedBCHCode decode(const BCHCode &code);
129 
131  DecodedBCHCode decode(const icl8u data[36]);
132 
134  DecodedBCHCode decode(const core::Img8u &image, bool useROI=true) ;
135 
137 
152  DecodedBCHCode2D decode2D(const core::Img8u &image, int maxID=4095, bool useROI=true) ;
153 
154  };
155  } // namespace markers
156 }
std::bitset< 4096 > BCHCodeSubSet
used to determine wich marker IDs are allowed
Definition: BCHCode.h:46
undocument this line if you encounter any issues!
Definition: Any.h:37
Class interface for un-copyable classes.
Definition: Uncopyable.h:64
DecodedBCHCode2D()
Definition: BCHCode.h:66
BCHCode origCode
given input code
Definition: BCHCode.h:50
Impl * impl
internal implementation structure
Definition: BCHCode.h:77
static const Size null
null is w=0, h=0
Definition: Size.h:64
Definition: BCHCode.h:68
Ipp8u icl8u
8Bit unsigned integer type for the ICL
Definition: BasicTypes.h:64
BCH decoder result.
Definition: BCHCode.h:49
bool operator<(const DecodedBCHCode &c)
compares two instance by their error-count
Definition: BCHCode.h:59
BCHCode correctedCode
corrected code
Definition: BCHCode.h:51
std::bitset< 36 > BCHCode
used 36Bit BCH Code -> 12Bit data max-Error: 4bit
Definition: BCHCode.h:43
slightly more comples decoding result that does also contain an rotation value
Definition: BCHCode.h:65
ICLMarkers_API std::ostream & operator<<(std::ostream &s, const DecodedBCHCode2D::Rotation &r)
ostream-operator for DecodedBCHCode2D::Rotation
ICLQt_API ImgROI data(ImgQ &r)
creates full ROI ROI-struct
Main class for BCH encoding/decoding.
Definition: BCHCode.h:76
Rotation
Definition: BCHCode.h:68
enum icl::markers::DecodedBCHCode2D::Rotation rot
Size class of the ICL.
Definition: Size.h:61
int errors
number of errors that occured
Definition: BCHCode.h:53
int id
corresponding id/index (<0 mean error)
Definition: BCHCode.h:52
DecodedBCHCode2D(const DecodedBCHCode &code)
Definition: BCHCode.h:67
#define ICLMarkers_API
Definition: CompatMacros.h:180