Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 7513

Camera board • Issue with Libcamera C++ API on Compute Module 5 and Hailo-8L

$
0
0
Greetings,

I recently purchased a Compute Module 5 with the Hailo-8l Accelerator as well as a camera module 3. For maximum performance utilizing the AI Kit i decided to execute post processing in C++. In order to communicate with the camera i decided to operate the libcamera c++ api. Unfortunately upon the destruction of my camera, camera manager and config. I ran into an error that I could not accomplish to fix.

Code:

#include <libcamera/libcamera.h>#include <libcamera/camera_manager.h>#include <iostream>#include <thread>using namespace libcamera;using namespace std::chrono_literals;int main() {    CameraManager cm;    cm.start();    if (cm.cameras().empty()) {        std::cerr << "No cameras available" << std::endl;        return 1;    }    std::shared_ptr<Camera> camera = cm.cameras()[0];    std::cout << "Camera: " << camera->id() << std::endl;    camera->acquire();    std::unique_ptr<CameraConfiguration> config = camera->generateConfiguration({ StreamRole::Viewfinder });    config->validate();    camera->configure(config.get());    if (camera->start() == 0) {        std::cout << "Camera started successfully." << std::endl;    } else {        std::cerr << "Failed to start camera." << std::endl;        return 1;    }    std::this_thread::sleep_for(1000ms);    camera->stop();    camera->release();    config.release();    cm.stop();    return 0;}

Code:

[0:10:16.022988395] [1005] ERROR DeviceEnumerator device_enumerator.cpp:165 Removing media device /dev/media0 while still in use[0:10:16.023491781] [1005] ERROR DeviceEnumerator device_enumerator.cpp:165 Removing media device /dev/media1 while still in use
In my search for a solution, I came across this forum post:
viewtopic.php?t=315490
While the user appears to face a similar issue, I wasn't able to derive a clear solution from their experience.

I’m running the standard Raspberry Pi OS with GUI, and the Libcamera CLI tools work correctly—for example, I can stream video using:

Code:

libcamera-hello
Any help or insights would be greatly appreciated.
Best regards,
Jan

Statistics: Posted by maupwastaken — Wed May 14, 2025 4:26 pm — Replies 0 — Views 43



Viewing all articles
Browse latest Browse all 7513

Trending Articles