[libcamera-devel] How to use this library

Kieran Bingham kieran.bingham at ideasonboard.com
Fri Mar 26 23:17:18 CET 2021


Hi Jason,

On 26/03/2021 20:55, Jason H wrote:
> So I can't find any good getting started guide on how to use this, and there isn't a
> liubcamera-users email list that I can find. But my own attempts have resulted in frequent crashing.
> 
> I am trying to use the libcamera-apps fom RaspberryPi:
> https://github.com/raspberrypi/libcamera-apps
> 
> However my efforts have been not successful in adapting their code.
> I don't want any preview - I just want to get images (memory access ok, if it
> is RGB888, BGR888, or I'll also accept file output as well) I don't want a preview,
> window, and I only want/need one frame per second (a sequence of stills). The code
> is already written against another library with a timer to acquire frames.

It sounds like the simple-cam might help you...

https://git.libcamera.org/libcamera/simple-cam.git/tree/simple-cam.cpp


> 
> My instant problem is on my pi (with a camera) it does not find any cameras: (cameras().size() == 0)
> 

Can you confirm that you are able to capture with the
raspberrypi/libcamera-apps?



> camera_manager_ = std::make_unique<CameraManager>();
> int ret = camera_manager_->start();
> if (ret)
>     throw std::runtime_error("camera manager failed to start, code " + std::to_string(-ret));
> 
> if (camera_manager_->cameras().size() == 0)
>     throw std::runtime_error("no cameras available");
> 
> There is stuff in the v4l tree:
> /dev/v4l/by-path/platform-bcm2835-codec-video-index0
> /dev/v4l/by-path/platform-bcm2835-isp-video-index1
> /dev/v4l/by-path/platform-bcm2835-isp-video-index3
> /dev/v4l/by-path/platform-bcm2835-isp-video-index0
> /dev/v4l/by-path/platform-bcm2835-isp-video-index2

Is this all that you have in /dev/v4l/by-path ?
I would expect more ...


> 
> I don't know what to do next.
> Help?

My first thoughts would be to verify that you have the Raspberry Pi set
up for use with libcamera.

This is very raspberry-pi specific, but you need to make sure you have
enabled the relevant camera dt-overlay in /boot/config.txt such as:

dtoverlay=imx219


If you have done that, you can enable full logging of the library to
really see what's going on underneath, and report the full traces.

LIBCAMERA_LOG_LEVELS=*:0 cam -l


> _______________________________________________
> libcamera-devel mailing list
> libcamera-devel at lists.libcamera.org
> https://lists.libcamera.org/listinfo/libcamera-devel
> 

-- 
Regards
--
Kieran


More information about the libcamera-devel mailing list