Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Public Member Functions | Static Public Member Functions | Private Attributes
icl::markers::BCHCoder Class Reference

Main class for BCH encoding/decoding. More...

#include <BCHCode.h>

Inheritance diagram for icl::markers::BCHCoder:
icl::utils::Uncopyable

List of all members.

Public Member Functions

 BCHCoder ()
 Default constructor.
 ~BCHCoder ()
 Destructor.
DecodedBCHCode decode (const BCHCode &code)
DecodedBCHCode decode (const icl8u data[36])
 decodes given (correctly oriented) byte image patch
DecodedBCHCode decode (const core::Img8u &image, bool useROI=true) throw (utils::ICLException)
 decodes given (correctly oriented) core::Img8u (optionally using its ROI or not)
DecodedBCHCode2D decode2D (const core::Img8u &image, int maxID=4095, bool useROI=true) throw (utils::ICLException)
 decodes given core::Img8u (optionally using its ROI or not)

Static Public Member Functions

static BCHCode encode (int idx)
 encodes a given index in range [0,4095] to a BCHBinary code
static core::Img8u createMarkerImage (int idx, int border=2, const utils::Size &resultSize=utils::Size::null)
 creates an image that show a given bch marker
static BCHCode rotateCode (const BCHCode &in)
 interpretes the given 36Bit as 6x6 image and rotates it by clock wise by 90 degree

Private Attributes

Impl * impl
 internal implementation structure

Detailed Description

Main class for BCH encoding/decoding.

Due to some internal buffers, this must be implemented as a class


Constructor & Destructor Documentation

Default constructor.

Destructor.


Member Function Documentation

static core::Img8u icl::markers::BCHCoder::createMarkerImage ( int  idx,
int  border = 2,
const utils::Size resultSize = utils::Size::null 
) [static]

creates an image that show a given bch marker

Parameters:
idxwhich marker
borderamount of border pixels (here, we use the unit of marker pixels, the maker code is always 6x6 marker pixels)
resultSizefirst a (2*border+6)x(2*border+6) image of the marker is created. Then it is upscaled to the given utils::Size using nearest neighbour interpolation. If resultSize is null, the (2*border+6)x(2*border+6) image is returned directly without upscaling

We use an error correcting 36Bit BCH code that carries 12 bit of information (i.e. each possible code is associated with a unique index (0 <= index <= 4095). The code provides automatic error correction for inputs that have not more than 4 errors. Its minimal hammin distance is 8. The higher the code indices, the lower their hamming distance:

  • min hamming distance > 8 : all
  • min hamming distance > 9 : IDs 0-63
  • min hamming distance > 10 : IDs 0-15
  • min hamming distance > 13 : IDs 0-3
  • min hamming distance > 16 : IDs 0-1

Benchmarks

Decoding works quite fast, however the decoder works slightly slower if errors have to be corrected. We benchmarked the BCHDecoder on an Intel(R) Xeon(R) CPU E5530 running at 2.40GHz, on 32Bit Ubuntu Linux. Decoding without errors (2ns) Decoding with 1,2 and 3 errors (3ns) Decoding with 4 errors (4ns)

Implementing the Configurable Interface

We used the code implemented by Robert Morelos-Zaragoza. You can find his copyright note in the corresponding .cpp file

decodes given (correctly oriented) byte image patch

DecodedBCHCode icl::markers::BCHCoder::decode ( const core::Img8u image,
bool  useROI = true 
) throw (utils::ICLException)

decodes given (correctly oriented) core::Img8u (optionally using its ROI or not)

DecodedBCHCode2D icl::markers::BCHCoder::decode2D ( const core::Img8u image,
int  maxID = 4095,
bool  useROI = true 
) throw (utils::ICLException)

decodes given core::Img8u (optionally using its ROI or not)

Internally, this methods checks for all 4 possible image rotations and returns the most plausible result.

Rotated Hamming Distances

If we allow rotations, the expected inter-marker hamming distances gets smaller.

  • min hamming distance > 1: all
  • min hamming distance > 2: 3080
  • min hamming distance > 4: 2492
  • min hamming distance > 5: 482
  • min hamming distance > 8: 18
  • min hamming distance > 10: 10
  • min hamming distance > 11: 4

please note that it's best to use the first N IDs if you want to use N markers

static BCHCode icl::markers::BCHCoder::encode ( int  idx) [static]

encodes a given index in range [0,4095] to a BCHBinary code

static BCHCode icl::markers::BCHCoder::rotateCode ( const BCHCode in) [static]

interpretes the given 36Bit as 6x6 image and rotates it by clock wise by 90 degree


Member Data Documentation

internal implementation structure

implementation pointer


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines