LCCV icon indicating copy to clipboard operation
LCCV copied to clipboard

Discussion: Fast RAW image acquisition

Open Rogerpi opened this issue 1 year ago • 1 comments

Hi,

I am making a simple ROS wrapper for the libcamera to grab images from the Raspberry Pi HQ camera and publish them as in a ROS topic. I attempted to do as suggested in the wiki, but capturePhoto(cv::Mat &) is slow due to the continuous start & stop of the camera.

I wonder if you have any suggestions on how to start the camera and continuously capture images. I did a quick attempt to just comment the Teardown and Close calls inside capturePhoto but it crashes due to "Multiple IPAManager objects not allowed"

Thanks

Rogerpi avatar Feb 21 '24 11:02 Rogerpi

Removing/commenting the start&stop from the PiCamera::capturePhoto function should work. I've tried with this modification with no problem at all. Anyway, I still get better performance using the video

bool PiCamera::capturePhoto(cv::Mat &frame)
{
    if(!camerastarted){
        app->OpenCamera();
        app->ConfigureStill(still_flags);
    }
    // app->StartCamera();

    LibcameraApp::Msg msg = app->Wait();
    if (msg.type == LibcameraApp::MsgType::Quit)
        return false;
    else if (msg.type != LibcameraApp::MsgType::RequestComplete)
        return false;
    if (app->StillStream())
    {
        // app->StopCamera();
        getImage(frame, std::get<CompletedRequestPtr>(msg.payload));
        // app->Teardown();
        // app->CloseCamera();
    } else {
        std::cerr<<"Incorrect stream received"<<std::endl;
        return false;
        app->StopCamera();
        if(!camerastarted){
            app->Teardown();
            app->CloseCamera();
        }
    }
    return true;
}

anguimru avatar Jun 17 '24 16:06 anguimru