Screenshots     Download     Purchase     Documentation     Tutorials     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. 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

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



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