Screenshots     Download     Documentation     Tutorials     Partners     Resources     Contact     Forum     Search  

 

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. Specify the color that overlay graphics should be displayed in.

2. 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. Specify how the COG should be displayed. Various options are provided as to how to indicate the location of the COG.

4. 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. Select if you would like to draw a box around the pixels that contribute to the COG. Since the image may have outlayer 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. 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. Specify how solid the COG object must be for tracking to be enabled. You can use both the number of non-zero pixels in the image falls below a certain amount. The "Stop tracking if pixel area is below X%" dropdown menu will stop tracking if the number of active pixels in the image is below a certain percentage of the entire image size. This will stop tracking when there are not enough pixels in the image to create a strong COG center.

8. Likewise the "Stop tracking if pixel density is below X%" 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 boudning 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.

Note that any graphics draw onto the image WILL become part of the image and are not floating. Thus, any successive processing filter will also act on the drawn graphics. It is recommended that the graphics are used only on a final step or just for test visualization.

Example

SourceCOG 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


© 2008 RoboRealm. All Rights Reserved. | Contact | Glossary | Privacy | Disclaimer | Link to Us | Resources | Site Map