Blob Colorize

The Blob Colorize module provides a way to recolorize blobs (segmented objects) based on another image (normally the
source pixel data). This is required when you have processed an image into separated blobs but need to recombine
the blobs with their original color information that was lost during processing.

The Blob Colorize will use a source pixel image and replace each non-black object with the various colors
drawn from the source image. This is functionally similar to using the blobs as masks into the source pixel
image and summing the resulting pixels to form the new color.

Interface

Instructions

2. Color - Select which color statistic to gather based on the source image that will be the new color
of the respective blob. When 'nearest' is selected the bottom part of the GUI interface will be enabled.

mean - Determines the mean color of the Source image masked with the current image and replaces
the current blob with that color. This colors the current blob with its average color in the Source image.

min/max intensity - Determines the minimum or maximum pixel intensity of the Source image masked with the current image and replaces
the current blob with that color. This colors the current blob with its min/max intensity as seen in the Source image.

min/max color - Determines the minimum or maximum pixel color of the Source image masked with the current image and replaces
the current blob with that color. This colors the current blob with its min/max color as seen in the Source image.

nearest - Determines the mean color of the Source image masked with the current image and replaces
the current blob with the color closest to that mean. This colors the current blob with one of the colors
as specified in the Nearest Colors list.

summation - Replaces the current blob with the added intensity values based on the Source image. This
enables the Weight field that is used to determine how the final intensity value is adjusted. When the weight
is set to 0.25 the pixels that belong to a blob are added as specified in the Source image multiplied by
the weight. This means a blob with 4 pixels of 255 intensity will result in a 255 white blob. This allows
smaller dimmer blobs to be eliminated (via a threshold) but smaller bright blobs to remain.

3. Label - specify the name of the color (as will be used in the variable array) such that you can
easily identify a color based on a name as apposed to an RGB triplet.

4. Add X - add in colors as needed in order to create a list of colors that will be matched against. For
each detected blob in the image the color those most closely matches that blobs color will become
that blobs color. This allows an almost white or almost red blob to become pure white or pure red assuming
that you have both white and red as "Nearest Colors".

5. Match Threshold - specify how closely a color should match one of the "Nearest Colors" to be replaced
with that color.

6. Summary Weight - enabled when Summation is selected. A weighting factor that is multiplied on each pixel
prior to the final intensity being capped.

Example

Source

Blob Colorize

The above demonstrates the blob colorizing routine after thresholding the image for high intensity, dilating by
2 and then using the blob colorizing module to recolor the resulting white blobs.

This technique is very handy for laser light detection. The issue with laser lights is that while we see them as
red (or green) but the camera sees them as white light surrounded by a red halo due to the color range limitation of CCDs. In order to detect "red" spots we
need to first detect likely laser spots, expand the blob and then test for color. The following shows
two laser lights from the SRV-1 robot and the final step of
the detected two laser lights with the X coordinate of the blobs (this can be used for distance sensing).
Download the robofile that accomplishes this.

Source

Laser Detected

Variables

BLOB_COLORIZE_LABELS - contains an array of matched color information for each blob.
The array contains blocks of 6 values per colorized blob. The elements
are as follows:
Offset Contents
0 x coordinate of the center of gravity of the blob
1 y coordinate of the center of gravity of the blob
2 hex formatted color information or label (when nearest color used)
3 Red color value
4 Blue color value
5 Green color value
For example, to look for red colored blobs you could now use
labels = GetArrayVariable("BLOB_COLORIZE_LABELS")
for i = 0 to ubound(labels)-1 step 6
if labels(i+3) = "255" and labels(i+4) = "0" and labels(i+5) = "0" then
write "Found a red blob" & vbCRLF
end if
next

about us

The RoboRealm application was created back in 2006 to take advantage of (1) lower cost generic
computing (i.e. PCs), (2) a widening range of lower cost imaging devices, (3) an increasing need
and usage of vision as primary sensor device and (4) the desire to quickly research custom solutions
using an interactive user interface with minimal programming.