Converting Area Measurement Annotations to Area

Converting Area Measurement Annotations to Area

These notes were prepared by Brian Schlining on 2012-12-10

Overview

After you've spent weeks drawing tiny little polygons on your Rover and Tripod images in VARS (a.k.a. adding area measurements), you will need to covert these associations to actual area values. VARS stores polygons as x-y pairs followed by a comment description of the measurement. For example, "1 2 20 20 100 200; the area of the 300th --explitive redacted-- salp in this --explitive redacted-- image. Please make it end!!". The x-y pairs define the pixel coordinates of each vertex of the area polygon. The instructions below will gently guide you through the steps needed to convert these pixel coordinates to actual honest-to-goodness planar area values in real world units like centimeters.

Information That You WILL Need

We will convert VARS annotations to area using the following camera parameters [1] (so go and collect this info now!!):
  • The camera height above the seafloor
  • The vertical angular field of view, alpha
  • The horizontal angular field of view, beta
  • The tilt angle of the camera from horizontal, theta

Known Camera Parameters

Rover (as of 2012-12-10)

  • Camera Height = 112 cm
  • Alpha = 33.6 degrees
  • Beta = 42 degrees
  • Theta = 39 degrees

How to Generate Areas

There are a few steps to walk. They are the following, and in the following order:
  1. Perform a query using the VARS query for imaging
  2. Save the results of the query to a text file
  3. Put the query results someplace that the computer Seaspray can see them from. Your directory on Tempbox is an excellent choice.
  4. ssh onto Seaspray from a terminal and go to the vars-imaging directory. If you're unfortunate enough to be running Windows, you may need to go and download PuTTY.
                ssh seaspray.shore.mbari.org
                cd /opt/vars-imaging/bin
              
  5. Run the process_area script like so:
                ./gsh ../scripts/groovy/process_area [cameraHeight] [alpha] [beta] [theta] [infile] [outfile]
              
    Substitute in your cameraHeight, alpha, beta, and theta values you looked up earlier. Infile is the file of annotations you saved earlier. Outfile is the file you want to write out to. Here's an example for the rover using a file stored in the tempbox brian
                ./gsh ../scripts/groovy/process_area 112 33.6 42 39 /mbari/Tempbox/brian/my_infile.txt /mbari/Tempbox/brian/my_outfile.txt
    
              
The end result will be a new file of annotations (the outfile) which is EXACTLY the same as your infile, EXCEPT there will be a new column appended. This column will contain the area in the square of the units you used for camera height. So if you used centimeters (cm) for height, areas will be returned as cm2. If there are multiple area measurement associations on a line, then there will be multiple area results appended to the line. There results will be in the same order as the corresponding association.

References