This component detects the ID and rotation of a marker by reading a circular barcode around previously detected particles. Both ID and rotation of a barcode are determined by correlating the barcode with all potential codes, which are defined in an XML file that looks as follows:
<?xml version="1.0"?> <objectlist> <objects> <object id="1"> <barcode> <chips length="14" symbol="15" /> <angle>0</angle> </barcode> </object> <object id="2"> <barcode> <chips length="14" symbol="332" /> <angle>0</angle> </barcode> </object> <object id="3"> <barcode> <chips length="14" symbol="6822" /> <angle>0</angle> </barcode> </object> </objects> </objectlist>
The algorithm also determines a confidence level for each detection, which might be helpful to reject wrongly detected particles (false positives).
The algorithm proceeds in two steps:
- All pixels lying on a ring around the particle are indexed with their angle. Angle and radius of a pixel are calculated using the center of the pixel and the (potentially sub-resolution) particle position.
- The so indexed pixels are correlated with all IDs under all possible angles in 1 degree intervals.
The best match (highest correlation) is assigned to the particle.
Please refer to the IDReaderRing example for scripts to generate suitable markers.
Note that the algorithm assumes a perfectly circular barcode, and therefore doesn't perform very well under large deformations. In addition, even though the algorithm is near-optimal in a well-configured setup, a fairly high resolution (and a well-focussed lens) is required to read such codes. E.g., 14-chip codes should appear as 20-by-20 pixels at least on the image.
A set of particles detected with e.g. the BlobDetectionCircularHough component, plus a grayscale image with the circular barcodes. Note that the particle center must lie in the center of the circular barcode.
The same set of particles, augmented with the ID, orientation and confidence value.
The outer radius of the ring.
The inner radius of the ring. Note that the inner radius should be chosen such as the blob in the center of the marker (if any) is not part of the ring.
Objects and codes
XML file with the object list (see description above).