SwisTrack/Components/BlobDetectionRedGreen

Description edit

This component detects markers consisting of a red and a green blob on a color image. The background is supposed to be uniformly black, gray, blue, yellow, or white. The particle position is the point between the two blob centers, while the particle orientation is pointing towards the red blob.

The component was originally written to detect green and red LEDs mounted on a robot, and works reliably even if the green (resp. red) blob consists of various shades of green (resp. red). Best results were achieved in a dark room where the only visible light on the camera images were the red and green LEDs.

The algorithm compares the green (g) and red (r) value and classifies each pixel into one of the following categories:

  • Red pixel, if  
  • Green pixel, if  
  • Gray pixel, otherwise

  and   denote the thresholds for the red resp. green blobs. The blue (b) channel is ignored.

Input edit

File:SwisTrack RedGreenBlobs.png

A color image with red and green blobs. The background is supposed to be uniformly black, gray, blue, yellow, white, or any combination of these colors.

Output edit

File:SwisTrack RedGreenParticles.png

Particles, with the center being between the red and green blobs, and the orientation pointing towards the red blob.

Parameters edit

Max. particles edit

Maximum number of particles to detect. Note that the algorithm first detects this many red and green blobs, and then matches them. Hence, if there are stray red or green areas in your image (not part of a marker), you should choose a number of particles that is slightly higher than the number of markers you deploy.

Max. distance edit

The maximum distance between the center of the red blob and the center of the green blob. Blobs that are farther away from each other are considered not being part of the same marker.

This distance is also used to eliminate stray blobs in the neighborhood of red or green blobs. More precisely, within any disk of this diameter (not radius), only the biggest red (resp. green) blob is detected.

Threshold (red and green blob) edit

The thresholds   and   (see description above).

Selection by area (red and green blob) edit

Check this to base blob selection on the blob area.

Min. blob size (red and green blob) edit

Minimum area in pixels of a blob to select.

Max. blob size (red and green blob) edit

Maximum area in pixels of a blob to select.

Selection by compactness (red and green blob) edit

Check this to base blobs section on the compactness of the blob.

Min. compactness (red and green blob) edit

Minimum compactness (0..1) of a blob to select.

Max. compactness (red and green blob) edit

Maximum compactness (0..1) of a blob to select.