test_camera

test_camera.test_filename_metadata()[source]

Validation Test Description

This module tests that when using the filename parameter (without an input message), the camera module outputs an image with correct metadata populated from deterministic sources.

Description of Variables Being Tested

When loading an image from a filename, the camera should set: - imageOutMsg.timeTag to the current simulation time - imageOutMsg.cameraID to the configured camera ID - imageOutMsg.imageType to 3 (RGB channels) - imageOutMsg.valid to 1 (image is valid)

This ensures that downstream consumers receive correct metadata for provenance and synchronization.

test_camera.test_invalid_filename_error()[source]

Validation Test Description

This module tests that when an invalid filename is provided, the camera module detects the failed image load and emits a BSK_ERROR.

Description of Variables Being Tested

When a bad filename, unsupported file, or malformed input is provided: - OpenCV’s imread() or imdecode() returns an empty cv::Mat - The camera module should check imageCV.empty() and emit BSK_ERROR - BSK_ERROR throws an exception that stops execution

test_camera.test_module(show_plots, gauss, darkCurrent, saltPepper, cosmic, blurSize)[source]

Validation Test Description

This module tests the proper functioning of the camera module. This is done by first ensuring that the reading and writing of the camera parameters are properly executed. The test then corrupts a test image accordingly.

Description of Variables Being Tested

The camera parameters tested are the camera position MRP and the isOn value for the camera. These ensure that the position is properly written and read. The image is also corrupted with the parameterized test information. This is directly tested by differencing the initial and processed image to see a change. and also ensures that the variables are properly read and that all the openCV functions are executing properly.

  • camera_MRP

  • isON

  • imageNorm Values

The comparative value for the test on the image is 1E-2 which depends on the corruptions but is allowed to me small as the relative difference of the images is taken (whereas pixel values can get large).

The two parameterized test are set with and without corruptions.

General Documentation Comments

The script could benefit from more profound image processing testing. Currently the bulk of the image processing is only tested by the result image.

test_camera.test_no_image_zero_msg()[source]

Validation Test Description

This module tests that when no image is present (no filename and no input message), the camera module properly outputs a zeroed-out message.

Description of Variables Being Tested

The camera output message should have all fields set to zero/empty when no image is available. This ensures that downstream modules receive valid (though empty) data.

  • imageOutMsg.valid should be 0

  • imageOutMsg.imageBufferLength should be 0

  • imageOutMsg.imagePointer should be nullptr