IMX519 ISO aperture control

Update works nice, thanks you.

I am testing the RAW scripts - will report. Looks great so far.

I am now on CM4 with 2 cameras and am testing the focusing. I can use
–lens-position arg
to adjust the focus plane in a command such as this:
libcamera-still --camera 0 --verbose 2 --shutter 10000 --rawfull --raw --immediate --output Camera1.jpg --encoding jpg --lens-position 2

Autofocus works nicely when using
libcamera-still -t 0 --autofocus-mode continuous

However the lens does not focus when trying to use the following parameters, when capturing just one still:

libcamera-still --camera 0 --verbose 2 --shutter 10000 --rawfull --immediate --output Test.png --encoding png --autofocus-mode auto --autofocus-speed fast --autofocus-on-capture

What am I doing wrong here?


these parameters are not recognised by libcam-still, but are listed in verbose

The camera outputs these controls as available:
Available controls:
AwbMode : [0…7]
Sharpness : [0.000000…16.000000]
ColourCorrectionMatrix : [-16.000000…16.000000]
LensPosition : [0.000000…32.000000]
ExposureValue : [-8.000000…8.000000]
AeExposureMode : [0…3]
Saturation : [0.000000…32.000000]
AfMode : [0…2]
NoiseReductionMode : [0…4]
FrameDurationLimits : [111092…248572499]
ColourGains : [0.000000…32.000000]
Brightness : [-1.000000…1.000000]
AfSpeed : [0…1]
AeMeteringMode : [0…3]
AwbEnable : [false…true]
AfWindows : [(0, 0)/0x0…(65535, 65535)/65535x65535]
AfPause : [0…2]
AeConstraintMode : [0…3]
AfRange : [0…2]
AeEnable : [false…true]
ScalerCrop : [(0, 0)/64x64…(0, 0)/4656x3496]
AnalogueGain : [1.000000…16.000000]
Contrast : [0.000000…32.000000]
ExposureTime : [592…248567756]
AfTrigger : [0…1]
AfMetering : [0…1]

How can these be controlled by libcamera-still?

I think we are using your special libcamera versions?
There is something I am not understanding here, I am sorry.


The cameras have a surprising shallow focus. Is there some sort of aperture control, to have a control over the focus depth?

The cameras seem to adapt ISO rating when shooting, ranging from 100 - 800 from what I have seen in the verbose output. Is there away to control the ISO, to be able to manage the noise levels of the images?

Thank you!!

I tried the RAW conversion, but it throws some errors.

ValueError: Input data size 20360704 does not match the expected size 20346720 for the given width (4656) and height (3496).

I used:

libcamera-raw -t 1100 --camera 0 --segment 1 -o test%05d.raw --width 4656 --height 3496

which wrote 2 files - as wanted

python3 --width 4656 --height 3496 -i test00000.raw -o test_bg.png -b RGGB

Errrors with this:
File “/home/photogrammetry/”, line 101, in
File “/home/photogrammetry/”, line 73, in convert
img = unpack_mipi_raw10(data)
File “/home/photogrammetry/”, line 44, in unpack_mipi_raw10
b1, b2, b3, b4, b5 = np.reshape(
File “<array_function internals>”, line 5, in reshape
File “/usr/lib/python3/dist-packages/numpy/core/”, line 299, in reshape
return _wrapfunc(a, ‘reshape’, newshape, order=order)
File “/usr/lib/python3/dist-packages/numpy/core/”, line 58, in _wrapfunc
return bound(*args, **kwds)
ValueError: cannot reshape array of size 20360704 into shape (4072140,5)

I encountered this array problem also earlier when experimenting with the 64MP .raw example footage.


We have not changed the parameter part, which is in sync with the official, and not all controls have been implemented officially. The focus part is also officially added recently.

Can you go into more detail on this part? Currently no control over aperture

You can control the amount of noise by controlling the iso, but you need to lower the frame rate so that the sensor can take a longer exposure, otherwise the iso control is too small to cause underexposure


This is because the Raspberry Pi has alignment requirements, I have fixed this problem, please re-pull the repository, and read the