Libcamera-vid w/IMX462 doesn't adjust negative ev values

While testing the IMX462 low light camera on an rPi3a with libcamera-vid I notice that negative EV (exposure compensation values) have no effect. E.g., libcamera-vid --ev -2 ... seems to show no effect. Positive values do have an effect. Using an official rPi V2 camera the negative EV values do work. Can you confirm that this is a bug somewhere in your driver or software?

By looking at the code of libcamera, the ev option does not support negative values.

image

image

Interesting… Looks like libcamera-vid and libcamera-still don’t care about that definition :laughing:
Using an official rPi V2 camera I ran:

libcamera-still --ev 0 --width 640 --height 480 --rotation 180 -o ev0.jpg
libcamera-still --ev 2 --width 640 --height 480 --rotation 180 -o ev2.jpg
libcamera-still --ev -2 --width 640 --height 480 --rotation 180 -o evn2.jpg

The results:
ev0.jpg
ev0
ev2.jpg
ev2
evn2.jpg (n==negative)
evn2

So --ev -2 definitely works as expected. Using an IMX462 I couldn’t reproduce this (I can’t try right now 'cause the camera is mounted outside and it’s too dark).

You can try to open the debug log:
export LIBCAMERA_LOG_LEVELS=RPiAgc:DEBUG

We can confirm whether it has the correct settings.

I did a couple more experiments this time using the arducam IMX462:

libcamera-still --ev 0 --width 640 --height 480 --rotation 180 -o ev0.jpg
libcamera-still --ev 2 --width 640 --height 480 --rotation 180 -o ev2.jpg
libcamera-still --ev -2 --width 640 --height 480 --rotation 180 -o evn2.jpg
libcamera-still --ev -6 --width 640 --height 480 --rotation 180 -o evn6.jpg

Here are the results I get:
ev0.jpg:
ev0
ev2.jpg:
ev2
evn2.jpg:
evn2
and evn6.jpg:
evn6

I don’t know about you, but I can’t make out any real difference between 0, +2, and -2. The ev -6 image is clearly darker. I hadn’t gone as far as -6 before and so hadn’t seen this. It’s clearly very dark at the moment, maybe in daylight the results are better, but if my earlier tests were accurate, then I don’t believe so…

In terms of debug output, it does print what I’d expect (this is for the ev -6 case):

[82:28:46.387628712] [11018]  INFO IPARPI raspberrypi.cpp:637 Request ctrl: ExposureValue = -6.00000

I don’t know where the exposure is calculated, but so far it seems to me that it’s not working all that well.

BTW: thanks a lot for your great support! It’s very appreciated!

I also didn’t see a noticeable difference.

I’m not sure about the problem here, because the software (libcamera) seems to be the same, and the exposure is completely controlled by software. .

As far as I know, the exposure is controlled in the IPA, i.e., what’s in https://github.com/ArduCAM/Arducam-Pivariety-V4L2-Driver/releases/download/ipa-v0.01/ipa_rpi.tar.xz
As far as I understand, Arducam took the open source IPA from rPi, modified it, and provides the above closed-source version. Looks like it doesn’t do EV correctly?

In fact, we did not change the original ipa code, we just added the code to read information from the device…