DriveWorks SDK Reference
5.8.83 Release
For Test and Development only

Camera Color Correction Workflow

Workflow

The workflow of the color correction module is:

  • Create a handle that points to the rig.json file, which is a file containing the camera's calibration data. With the handle, the module can extract the ground area from each camera view.
dwRig_initializeFromFile(&rigConfig, sdk, "rig.json");
ccParams.cameraWidth = g_imageWidth;
ccParams.cameraHeight = g_imageHeight;
dwColorCorrect_initializeFromRig(&cc, sdk, rigConfig, &ccParams);
uint32_t cameraWidth
Width of the images from camera to be corrected. Must be even.
DW_API_PUBLIC dwStatus dwColorCorrect_initializeFromRig(dwColorCorrectHandle_t *obj, const dwColorCorrectParameters *parameters, dwRigHandle_t rigConfig, dwContextHandle_t ctx)
Creates and initializes the color correction module using dwRig.
struct dwColorCorrectObject * dwColorCorrectHandle_t
Handles representing the Color Correction interface.
Configuration parameters of the color correction module.
#define DW_NULL_HANDLE
Definition: Types.h:96
struct dwRigObject * dwRigHandle_t
Handle representing the Rig interface.
Definition: Rig.h:70
DW_API_PUBLIC dwStatus dwRig_initializeFromFile(dwRigHandle_t *const obj, dwContextHandle_t const ctx, char8_t const *const configurationFile)
Initializes the Rig Configuration module from a file.
  • Send the master camera's image to the handle to extract its statistical color distribution data.
dwColorCorrect_setReferenceCameraView(frameCUDAyuv, cameraIdx, cc);
DW_API_PUBLIC dwStatus dwColorCorrect_setReferenceCameraView(const dwImageHandle_t referenceImage, uint32_t cameraIdx, dwColorCorrectHandle_t obj)
This method adds reference view to color correction; the color of all the other views are corrected b...
  • Send the images captured from the rest of the cameras to the handle. It calculates their statistical color data and matches them to the statistical color distribution of the image from the master camera. The input images shall be in the format of YUV420.
dwColorCorrect_correctByReferenceView(frameCUDAyuv, cameraIdx, 0.8f, cc);
DW_API_PUBLIC dwStatus dwColorCorrect_correctByReferenceView(dwImageHandle_t image, uint32_t curCameraIdx, float32_t factor, dwColorCorrectHandle_t obj)
Applies global color correction on the given image.

The third argument of the function is a factor that controls how much the master camera affects the current view. The range of input for the factor argument is [0.f to 1.f], where:

  • 0.f means that there is no correction. Instead, the function uses the current camera's own color.
  • 1.f means 100% dependency on the master camera's color distribution.

The default value is 0.8f.

For a demonstration of this workflow, see Camera Color Correction Sample.