Circles

The Circles module is a shape detection module that identifies contours
within an image that are circular. The Circles module is meant to
run after a contour based module (like Canny,
DOB, Sobel, etc.) that
identify edges within an image. Using these edges the Circles module
will determine which contours are part of a circular shape and
identify that shape for successive processing.

Note that since the Circles module is contour based several edge processing
routines can be applied prior to the Circles module to best create
distinct contours.

Interface

Instructions

1. Threshold - Select the circle threshold. The threshold value sets the sensitivity
of the circle detector. The lower the threshold the more partial circles
will be detected. The higher the value the more complete and defined
the circles will need to be.

2. Min Radius - Select the minimum radius of detected circles. Any circles detected
whose radius is less than the minimum radius will be eliminated.

3. Max Radius - Select the maximum radius of detected circles. Any circles detected
whose radius is more than the maximum radius will be eliminated.

4. Circle Solidity - Select how solid a detected circle needs to be. The circle solidity
is a measure of standard deviation of a circle's pixel values. The lower
the solidity percentage the larger the standard deviation. The higher the
solidity percentage the lower the standard deviation which translates
into a more purely solid circle (i.e. a flat same color circle).

5. Isolation - Select how close to each other can circles can be detected. The larger the isolation the
more space between successive circles needs to exist. If you find that
too many overlapping circles are detected increase the isolation number as
this will reduce overlapping circles.

6. Isolation Scope - Determine what area is considered when determining if two circles overlap. It set to
radius then the isolation is determined by adding the isolation pixels to the current circle size. Thus if
any circles include each other the less stronger circle will be eliminated. If center is chosen then
circles that are within X pixels of each other's center will tested for elimination.

7. Satistics Use - Select which image should
be used to calculate the solidity and other circle statistics. Since the
current image needs to be a contour image you will need to select which
image can be used to access the circles original pixel data.

8. Circle Color - Select which color you would like to replace a detected circle with.
The values [mean], [median] and [mode] relate to a circles statistical
values of the original pixels. Circles will then be draw in that appropriate
color.

9. Fill Circles - Select if you want to fill the detected circles with the appropriate
color selected above. If "Fill Circles" is not selected then circles will
not be filled and remain as thin circles.

10. Center Color - Select which color the X in the center of the circle will be draw using.

12. Overlay on - Select which image the circle will be draw on. If none is selected
the circles will be draw on a black cleared image.

Example

Source

Canny Edges

Detected Circles in Red

Edges

Variables

CIRCLES_COUNT - the number of detected circles
CIRCLES - contains an array of detected circles.
The array contains blocks of 13 values per detected circles. The elements
are as follows:
Offset Contents
0 x coordinate of the center of gravity of the circle
1 y coordinate of the center of gravity of the circle
2 radius of the circle
3 standard deviation of the circle pixel colors
4 mean red color of the circle
5 mean green color of the circle
6 mean blue color of the circle
7 median red color of the circle
8 median green color of the circle
9 median blue color of the circle
10 mode red color of the circle
11 mode green color of the circle
12 mode blue color of the circle
For example, to add up all the radii of detected circles the VBScript code would be
circles = GetArrayVariable("CIRCLES")
for i = 0 to ubound(circles)-1 step 13
radius = radius + circles(i+2)
next
SetVariable "total_radius", radius

To calculate the mean radius and standard deviation of the radius download the
Circle Statistics Example robofile. Note that this includes
an example image.

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.