How to use code to access libcamera(C++/Python)

hi, jz0000

You can enter the following command on the command line to view the path of the dependent library:

pkg-config libcmaera --cflags

The following command looks at the dependent library name:

pkg-config libcamera --libs

Can you explain what this means? I have the 64 MP camera. Does Picamera2 currently support this camera?

hi, @alloneword

The libcamera deb package with picamera2 has been released. You only need to execute the installation script on the bullseye system with the Raspberry Pi kernel version greater than or equal to 5.10.92.

picamera2 supports 64mp cameras.

I tried adding “cam.set(libcamera.AfTrigger, 1)” to the python code and running it for my 64MP-AF camera, but it has no effect. Can someone help ?

hi, @Hosken79

The libcamera-dev Deb package with Picamera2 has been released. We recommend using Picamera2, which we will no longer maintain this library.

Hi,

Do you have examples of how to use Picamera2 with the new camera ? and its autofocus settings ?

I see you have a script here :- Raspberry Pi Camera Autofocus: Complete Guide (V1, V2 & HQ)
but this no longer works with Picamera2

Thanks
Mark

hi, @Hosken79

The official examples of picamera2 all work with 64mp cameras.

Example links are below:

Hi, I cant see an example of picamera2 using focus, please can you tell me which file it is or can you please provide an example. Otherwise all the photos are fuzzy.

Hi Hosken79,
I’m in the same situation as you are. I bought the 64mp on purpose for its autofocus but it seems we can’t use it in python script…but working fine in libcamera-app*.*
I talk with LibCamera dev team. They say they don’t have the knowledge from Arducam to code it…
The ball is in Arducam’s side.

hi,

After our test and ask the official of picamera2. There’s really no way to use the autofocus control.

We will continue to maintain our wrapped libcamera python library. This may take some time.

hi, @izd

The autofocus control code is what we added to libcamera. So it will only work if our libcamera-dev deb package is installed.

Regarding the problem of not being able to control autofocus in python, we will find the cause and solve it as soon as possible.

Hi yang,

Thanks you for answer.

So, I bought this camera for the 64mp sensor AND the autofocus.

The code to control the autofocus behavior exists in yours apps (libcamera-still/jpeg/raw/vid).
Where is the source code of these apps ?

Maybe I could hack something to go ahead in my project.

@izd @Hosken79

We found a solution that we can use Python to implement autofocus now.

I did a fresh install and followed the guide and then when i try running the example i get this :- python3 capture_demo.py
[0:03:13.476992651] [1167] WARN IPAManager ipa_manager.cpp:149 No IPA found in ‘/usr/local/lib/arm-linux-gnueabihf/libcamera’
[0:03:13.477407651] [1167] INFO Camera camera_manager.cpp:293 libcamera v0.0.0
Segmentation fault

hi, @Hosken79

Which version of Raspberry Pi system do you use? Bullseye or Buster?

You can use the following command to view:

uname -a
cat /etc /os-release

Which version did the libcamera Python library installed?

Hi, Everyone

Regarding the libcamera python library incompatibility with libcamera-dev 0.0.7 version, we have found the problem and solved it.

We updated the version number of the libcamera python library to 1.0.3. This version only supports Bullseye Raspberry Pi systems with kernel version greater than or equal to 5.10.92.

You can download it from the link below.

my version is this :-
Capture
image

and the one that was in the guide you siad to follow :- How to use arducam_64mp & arducam_64mp FQA - #19 by Edward
Ive also installed the 1.0.3 version and i still get the same message.

Could you not create a script, that does all the installing bits when its a fresh version OS on a PI ?

hi, @Hosken79

You can check the version of libcamera-dev with the command below.

dpkg -l | grep libcamera

The libcamera python 1.03 version library corresponds to the libcamera-dev 0.0.7 version, you can try to reinstall the libcamera-dev deb package.

Thanks for the heads up, we will consider integrating the installation process of the libcamera python library into the installation script.

Ive run the live above and it says this :-

What should i do next ?

hi

I suggest you to reinstall libcamera-dev.