How to access pivariety camera via opencv directly without using V4L2loopback

Hi , Recently I have purchased an Pivariety camera B0323 IMX298 from Fat.to.Lab and successfully installed pivariety driver & libcamera in Raspberry pi 4 with help of [email protected] .V4L2loopback is used to access pivariety camera via opencv but v4l2loopback has to run at background, that make My application much slower than I expect .Is there any alternative way to access camera via opencv without using v4l2loopback at background.Please kindly give support to overcome this issue

Nice that this Q has been ignored :frowning: I’d also like to know this, as using loopback is beyond useless - I get 1/4 the frame rate using this technique. It’s terrible.

How can I use my very expensive 21MP IMX230 PiVariety based Arducam camera in OpenCV at full speed like other cameras? There must be a way.

Anyone from Arducam want to chime in considering the Q was first asked 4 months ago?

Thanks

Hi Wong,

Thanks for replying so quickly.

Right, but my entire application is in openCV including source video capture. Do you have example code to take video capture from your Python API and convert it so openCV can use it? I assume this wil take a performance hit per frame, t ti cant be as bad as using the loopback option.

Can you explain to me why the cameras can’t be natively supported in openCV? Is it something the openCV folks need to provide? Or is it a raspberry OS issue?

I have an older ArduCam auto-focus camera that is UVC and it works great with openCV, and I also have the original and HQ PI cameras that also work great on openCV.

Why cant these newer camera just work as well?

Thanks
Seon

This is a problem with the libcamera camera stack, it gets the RAW format from the video0 node and processes it using the Raspberry Pi’s ISP, but libcamera is also an application and it can no longer send data back to the video node.

I’ve been playing with the Python examples you posted @wong - thanks.

Are there any additional python examples for this for features like setting focus and other camera attributes? I’m looking specifically at the IMX230 21MP camera.

The API for this library is quite different to the other Pivariety python examples for the V4L2 driver.

Thanks

They are the same because they both use libcamera.
Only the drivers installed are different.

How can I fix the focus of the camera. I am using the python demo script from the libcamera file. I see the change in camera focus/lighting whenever a new object comes in front of the camera. But I do not want that behaviour. How can I make it not change the scene.

You can turn off auto exposure by setting fixed exposure and gain.
For autofocus, it will be fixed after being adjusted once, and we don’t have continuous autofocus support yet.