Argus nvraw source code

I’m using [Jetpack 5.1.2] Argus nvraw tool to capture raw and jpg images along with metadata. I noticed that for jpg images, there is a ISP digital gain applied based on the metadata file. From the documentation, there are no sensor controls available to fix the digital gain for nvraw utility.

Is there a way to fix digital gain for jpg images captured using nvraw tool? Is the source code for nvraw tool available to modify sensor controls?

The command used to capture jpg image is -
sudo nvargus_nvraw --format "raw,jpg" --exp0 "0.1,1" --file "nvraw_1ms" --mode 1

The generated metadata file adds ISP digital gain of 3.204291 as shown below.

frame[0].plane[0].exposure_time = 0.100000;
frame[0].plane[0].sensor_gain = 1.000000;
frame[0].plane[0].sensor_awb_gains[0] = -1.000000;
frame[0].plane[0].sensor_awb_gains[1] = -1.000000;
frame[0].plane[0].sensor_awb_gains[2] = -1.000000;
frame[0].plane[0].sensor_awb_gains[3] = -1.000000;
frame[0].plane[0].isp_digital_gain = 3.204291;

hello userc1274,

may I also confirm the sensor module you’re using, had you apply ISP overrides?
besides, we did not public release Argus nvraw source code.

Hello JerryChang, thanks for your reply.

For this test, I deleted the ISP overrides file and verified in nvargus-daemon logs that ISP overrides file is not applied, but still see that digital gain is applied for jpg and raw images (in the generated metadata file). Is there a way to fix the digital gain to 1.0 for nvraw captures?

hello userc1274,

let me double confirm your Jetpack release version and Jetson platform you’re working with.
it seems this is topic from Jetson TX2 which doesn’t looks right.

Hello JerryChang,

Looks like I’ve posted in the wrong forum. I’m using Jetpack 5.1.2 on AGX Orin, not TX2. Can I continue this topic here or could you help move this topic to the correct forum? Thanks.

I’ve moving this bug ticket to AGX Orin category.

could you please gather camera stack debug logs.
you may follow below configuration on the target to enable the logs.
$ sudo su
# pkill nvargus-daemon
# export enableCamCoreLogs=5
# nvargus-daemon 2>&1 | tee argus-output.log

it’ll output lots of logs,
please dig into convergence status, which contain the ISP digital gains applied by camera software stack.
for instance,
runBreakDownAlgorithm output ---: convergenceStatus: 1, framerate 30.00000, requiredCain 0.01330 totalAchievedCGains 0.01330 with AA 0.17361 {step 0, f-Number 2.40000}, ET 0.03333, AG 2.29763, ISPDG 1.00000

Sorry for the delayed response.

ISP overrides file is removed for the below tests.

Test 1 - For nvraw captures with 1ms exposure, ISP digital gain is being applied.
Command - sudo nvargus_nvraw --format "raw,nvraw" --exp0 "0.001,1" --file "nvraw_m2" --mode 1
In the nvargus-daemon logs, we can see that ISP digital gain settles at 2.28519 - Attached AE_log-m2.txt
How is digital gain applied for raw captures?
AE_log-m2.txt (18.2 KB)

Test 2 - For jpg captures with 1ms exposure, ISP digital gain is being applied.
Command - sudo nvargus_nvraw --format "raw,jpg" --exp0 "0.001,1" --file "nvraw_m4" --mode 1
In the nvargus-daemon logs, we can see that ISP digital gain settles at 2.28487 - Attached AE_log-m4.txt

For longer exposures, digital gain is fixed at 1. Is there a way to control digital gain for shorter exposures?
AE_log-m4.txt (18.2 KB)

hello userc1274,

I’m also curious your sensor capability, please also share your mode-1 exposure/gain limitations,
also, let’s try adding verbosity config to gather more logs for running nvargus_nvraw.
for instance,
$ sudo nvargus_nvraw --format "raw,jpg" --exp0 "0.1,1" --file "nvraw_1ms" --mode 1 --verbosity debug

hello userc1274,

BTW, we cannot repo this locally on developer kit.
runBreakDownAlgorithm output ---: convergenceStatus: 2, framerate 9.52381, requiredCain 0.01736 totalAchievedCGains 0.01736 with AA 0.17361 {step 0, f-Number 2.40000}, ET 0.10000, AG 1.00000, ISPDG 1.00000

may I know what’s your environment setups, for instance, did you capture frames at low-light environment?

Hello JerryChang,

Yes, this is captured in low-light environment.

Here is sensor mode-1 capabilities. Exp is 34us to 400ms and analog gain is 1-32x.

nvargus_nvraw version 1.14.0
Number of sensors 1, Number of modes for selected sensor 4
Selected sensor: imx485_bottomleft_0LQR ID 0 Mode 1
Number of exposures 1
Index   Exposure time Range          Sensor Gain Range
0       0.000034 - 0.400000          1.000000 - 31.622776

Nvraw 100ms captured with debug logs enabled using the command -
sudo nvargus_nvraw --format "raw,jpg" --exp0 "0.1,1" --file "nvraw_100ms" --mode 1 --verbosity debug
For 16ms and above exposure, I’ve observed that ISP digital gain is 1.
log-raw-100ms.txt (32.6 KB)
nvraw_100ms.txt (1.9 KB)

Nvraw 1ms captured with debug logs enabled using the command -
sudo nvargus_nvraw --format "raw,jpg" --exp0 "0.001,1" --file "nvraw_1ms" --mode 1 --verbosity debug
For 1ms exposure, the ISP digital gain is applied. Is there a way to eliminate digital gain?
log-raw-1ms.txt (31.4 KB)
nvraw_1ms.txt (1.9 KB)

hello userc1274,

all right, it’s due to low scene lux. AE by default to enable ISP digital gain when estimate low scene lux.
for your use-case, please add below to ISP override file to limit the ISP digital gain,
i.e. ispDigitalGain.MaxIspDigitalGain = 1.0;

That fixed the ISP digital gain for jpg and raw images, thanks.

At what stage of the camera pipeline does nvraw capture and return raw images? Because I’ve observed that the metadata file generated for raw images at shorter exposures and low scene lux also shows that ISP digital gain is being applied.

hello userc1274,

sorry, I don’t get your question.
did you meant you still seeing ISP digital gain has applied when capture with low scene lux?

Hello JerryChang,

After adding this line ispDigitalGain.MaxIspDigitalGain = 1.0; , no ISP digital gain is applied for low scene lux. That works.

My question was, at what stage of the camera pipeline does nvraw capture and return raw images? Looks like it’s after the ISP, as it goes through AEC even for raw captures?

hello userc1274,

that’s due to nvargus_nvraw by default skip 90-frames before the final frame that gets saved.
it’s in order to have those camera controls stable/converge for capturing an *.nvraw.

you may running with v4l IOCTL if you’re trying to bypass ISP.
for example,
$ v4l2-ctl --set-fmt-video=width=1920,height=1200,pixelformat=BA10 --set-ctrl bypass_mode=0 --stream-mmap --stream-count=1 --stream-to=test01.raw -d /dev/video0

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.