Center of Gravity
The Center of Gravity or Center of Mass statistic calculates
where the COG of the image lies.
The COG is calculated by:
COG_X = COG_X + (I*x)
COG_Y = COG_Y + (I*y)
Total = Total + I
for each pixel where I = (R+G+B)/3 and x,y is the current
pixel location. The resulting COG is then divided by the Total value:
COG_X = COG_X/Total
COG_Y = COG_Y/Total
to result in the final x,y location of the COG.
Note that based on the way this COG is calculated brighter
pixels will exert more pull on the final COG location than darker pixels.
The COG module interface also provides for various graphical overlays.
Interface
Instructions
1. Graphic Color - Specify the color that overlay graphics should be displayed in.
2. Overlay On - Specify which image the graphics should be show on. This option allows you to revert the current
image to the source image to display graphics.
3. Show COG as a - Specify how the COG should be displayed. Various options are provided
as to how to indicate the location of the COG.
3. Display as Annotation - Select if you want the graphic to be draw after all processing has been
completed. If this is NOT selected then the next module in the processing pipeline will see the graphic as if
it were part of the image and process it accordingly.
4. Connect COG to Center - Specify if you want to draw a line from the COG to the center of screen.
This is helpful to indicate how much off center the COG is. The difference
between the COG and the center of screen can be used to drive differential
motors accordingly.
5. Show bounding Box - Select if you would like to draw a box around the pixels that contribute
to the COG. Since the image may have outlier pixels that are not part of the
main object within the image you can select the percentage contribution
instead of the entire image. Lowering the bounding box percentage will
shrink the boxed area towards the COG.
6. Show Coordinates - Specify if you would like to show the actual COG values drawn in the
image. This can give you a better idea of the actual COG values being used
within your VBScript or other programming extensions.
7. Sub Pixel COG - If you need the COG calculation to be subpixel based select the "Calculate Sub-Pixel COG" which
will change the COG_X, and COG_Y to decimal based.
8. Filter Area - Specify how solid the COG object must be for tracking to be enabled. You
can specify the number of non-zero pixels (pixel area)
that must exist in the image in order for tracking to continue.
If the image contains less than the specified number of pixels then the module will terminate all processing of
the pipeline. The pipeline processing would be then
restarted after the next image capture.
9. Filter Density - Likewise the "pixel density" will determine how many non-zero
pixels are within the current bounding box to determine how 'dense' the collection of pixels are.
If just noise (small non-zero pixels spread across the image) is present the density of the
bounding box will be very low. If, however, the bounding box is focused around a solid object then
the density will be very high. Note that the density will be close to 100% for square objects and
less than that for other shaped objects.
Example
| Source | COG after thresholding |
 |  |
Variables
COG_X - center of gravity X coordinate
COG_Y - center of gravity Y coordinate
COG_AREA - non-zero pixels within the current image
COG_BOX_SIZE - width or height of the COG box. Note that the bounding box
is ALWAYS square
COG_WEIGHT - summation of pixels contributing to the COG
COG_DENSITY - COG_AREA / (COG_BOX_SIZE*COG_BOX_SIZE) provides a sense of how
dense the bounding box is
| Center_of_Gravity Related Forum Posts | Last post | Posts | Views |
Servo Reversing
Hi there,
I just hooked up an SSC 32 servo controller board. seems to be working well.
| 2 months |
5 |
133 |
COG_BOX_SIZE = 0 when box display = 100%
I just noticed a bug in RR 2.14.15. If you use the COG module and set the displayed box size to 100%, then the COG_BO... |
6 months |
3 |
181 |
Variable Values on VBScript
Hello,
I am doing a visual odometry for 3 robots with a camera (determinate the X,Y,theta - positio... |
7 months |
14 |
828 |
Font format error
When I start up I get a pop up that says "Font format error on font line 2! Please use font.txt to specify the correct characte... |
7 months |
2 |
148 |
assign xyz axis
Hi,
Can Roborealm assign new reference axis. For example, I have 2 objects. Object1 axis is 0,0,0... |
10 months |
11 |
865 |
Serial Sequence
In the serial communications console area i am sending the code
\\x10\\xff\\xef\\x80\\x80\\x80\\x80... |
4 months |
35 |
1032 |
cog box size variable never resets to null?
This is more a vb script question, how can I get a bunch of variables to reset after the cog module is no longer displaying on s... |
4 months |
5 |
393 |
COG for large images
The COG module doesn't seem to work for the attached, very large image and the Geometric Statistics module gives negative value... |
6 months |
3 |
473 |
|