16.9. cam_test

This tool compares two camera models for the same image, or a camera model against itself. It finds the camera center and ray direction at a set of sampled pixels for both cameras and checks how they differ. Then, it projects pixels to the datum using the first camera and back-projects the resulting ECEF points into the second camera, and estimates the pixel discrepancy.

It prints the average time (in milliseconds) for the operation of projecting from the camera to the ground and back.

16.9.1. Examples

See Section 8 for information on the camera types used below.

16.9.1.1. CSM against itself

Compare a CSM camera model against itself:

cam_test --image input.cub \
  --cam1 input.json        \
  --cam2 input.json        \
  --session1 csm --session2 csm

16.9.1.2. Exact linescan vs RPC

Compare a PeruSat-1 exact linescan model to its RPC approximation:

cam_test --image input.tif \
  --cam1 exact_cam.xml     \
  --cam2 rpc_cam.xml

Here the two individual camera types will be auto-guessed as perusat and rpc, or can be specified as above with --session1 and --session2.

16.9.1.3. ISIS vs CSM

Compare ISIS to CSM cameras:

cam_test --image input.cub \
  --cam1 input.cub         \
  --cam2 input.json        \
  --sample-rate 5000

16.9.1.4. DigitalGlobe exact vs RPC

Compare the exact and RPC model stored in the same DigitalGlobe / Maxar file:

cam_test --image input.tif     \
  --cam1 input.xml             \
  --cam2 input.xml             \
  --session1 dg --session2 rpc \
  --sample-rate 1000

16.9.1.5. Pinhole model

Evaluate a camera transformed with convert_pinhole_model (Section 16.15). In this case the session names would be the same but the cameras would differ:

cam_test --image input.tif \
  --cam1 in.tsai           \
  --cam2 out.tsai          \
  --session1 pinhole --session2 pinhole

16.9.1.6. CSM ground-image roundtrip

Here we evaluate a CSM camera against itself, with no .cub image file. The image dimensions are contained in the camera file. This verifies that the ground-to-image and image-to-ground functions are inverse of each other, up to a certain tolerance:

cam_test --image input.json     \
  --cam1 input.json             \
  --cam2 input.json             \
  --session1 csm --session2 csm \
  --sample-rate 100             \
  --subpixel-offset 0.3

16.9.1.7. Bathymetry-corrected camera

Evaluate a bathymetry-corrected camera (Section 8.32) against itself. Each camera takes its own bathy plane. This example compares a plain-text bathy plane vs one specified as a georeferenced raster (Section 16.3.10):

cam_test --image input.tif           \
  --cam1 input.xml                   \
  --cam2 input.xml                   \
  --cam1-bathy-plane bathy_plane.txt \
  --cam2-bathy-plane bathy_plane.tif \
  --refraction-index 1.34            \
  --height-above-datum -50

A height above datum below the water surface is chosen so that the rays from the camera encounter the water surface. If the candidate ground point is above the water surface, refraction is skipped (the ray reaches land before the water), so the test would silently exercise no refraction.

16.9.2. Usage

cam_test --image <image file> --cam1 <camera 1 file> \
  --cam2 <camera 2 file> [other options]

16.9.3. Command-line options

--image <string>

Image file.

--cam1 <string>

Camera 1 file.

--cam2 <string>

Camera 2 file.

--session1 <string>

Session to use for camera 1 (if not provided it will be guessed).

--session2 <string>

Session to use for camera 2 (if not provided it will be guessed).

--sample-rate <integer (default: 100)>

Use one out of these many pixels when sampling the image.

--subpixel-offset <double (default: 0.0)>

Add to each integer pixel this offset (in x and y) when sampling the image. Sampling at non-integer location may make testing more thorough.

--single-pixel <double double (default: nan nan)>

Instead of sampling pixels from the image use only this pixel.

--print-per-pixel-results

Print the results at each pixel.

--datum <string>

Set the datum. This will override the datum from the input cameras. Usually needed only for Pinhole cameras, when the camera does not have the datum information. Options: WGS_1984, D_MOON (1,737,400 meters), D_MARS (3,396,190 meters), MOLA (3,396,000 meters), NAD83, WGS72, and NAD27. Also accepted: Earth (=WGS_1984), Mars (=D_MARS), Moon (=D_MOON).

--height-above-datum <double (default: 0.0)>

Let the ground surface be at this height above the datum (measured in meters).

--bundle-adjust-prefix <string (default = “”)>

Adjust the cameras using this prefix (Section 16.5).

--cam1-bundle-adjust-prefix <string (default = “”)>

Adjust the first camera using this prefix.

--cam2-bundle-adjust-prefix <string (default = “”)>

Adjust the second camera using this prefix.

--cache-size-mb <integer (default = 1024)>

Set the system cache size, in MB.

--cam1-bathy-plane <string>

Bathy plane (water surface) used with the first camera. Either a text plane file in local projected coordinates (Section 16.3.10) or a GeoTIFF raster of water surface heights. A ray from the camera to the ellipsoid determined by --height-above-datum that encounters this bathy plane along the way will get bent according to Snell’s law. Same for a ray going in reverse.

--cam2-bathy-plane <string>

Bathy plane (water surface) used with the second camera. Same format as --cam1-bathy-plane.

--refraction-index <double (default: 1.0)>

The index of refraction of water to be used in bathymetry correction. Must be bigger than 1. This index can be computed with refr_index.

-h, --help

Display the help message.