Custom tone maps

I’m trying to create a custom tonemap using libargus. I’m using the example 10_camera_recording:
https://docs.nvidia.com/jetson/l4t-multimedia/l4t_mm_camera_recording.html

I’ve then modified the program to add the following code:

// Get autocontrol settings
IAutoControlSettings * settings = interface_cast<IAutoControlSettings>(iRequest->getAutoControlSettings());
std::vector<float> curve;
float value = 0;
int points = settings->getToneMapCurveSize(RGB_CHANNEL_R);
for (int i = 0; i < points; i++)
{
    curve.push_back(value);
    value = std::pow(i/129.0f, 2.2);
}
settings->setToneMapCurveEnable(true);
settings->setToneMapCurve(RGB_CHANNEL_R, curve);
settings->setToneMapCurve(RGB_CHANNEL_G, curve);
settings->setToneMapCurve(RGB_CHANNEL_B, curve);

I’ve tried a linear curve, different power curves, etc. But the image starts out and the exposure drives to 0. So the image is completely black after a few seconds. Any ideas why this happens? It almost seems like the auto exposure algorithm is AFTER this curve. Which is odd. So the autoexposure system seems to see a bright image and drives it darker. Any ideas how to fix this?

hello Shadowmind,

please refer to the documentation, Argus::ICaptureSession::repeat.
repeat() is a convenience method that will queue a request whenever the request queue is empty and the camera is ready to accept new requests.

hence,
please have a try by calling repeat() again to apply your capture settings,
for example,

iAutoSettings->setToneMapCurve();
iSession->repeat();

The image completely black at beginning should be the AE alg need to time to stable. Suppose doesn’t matter with the tone map setting. You can confirm without set the tone curve.