Is there any plan to support libcamera?
-
@thn
I would like to outline my thoughts here.
In the last few days I took a brief look at the code of libcamera and libcamera-apps.
They use the very new Morden C++ (C++17 I think), which causes me to read very slowly. C++ has changed so much over the years that I almost don't recognize it anymore.I don't guarantee that what I say is completely correct.
This diagram below is from the official Raspberry Pi documentation. It is the basis for our discussion.
The Raspberry Pi encapsulates the image processing functions of ipa and gpu to the linux driver level and provides application layer calls in the form of video node.
libcamera stack
This is the pipeline of libcamera :
sensor's bayer raw data from video0 ---> video13-----> [ISP functions]--->video14----->YUV420------> apps
libcamera do not call video14 directly, It use Streams provided by libcamera.
The solution to use VEYE camera with libcamera I foresee
NO.1
Give up libcamera, because libcamera is essentially for isp service, VEYE camera has built-in isp function, so there is no need to use libcamera at all.
From /dev/video0 we can get the output data of camera directly, which is UYVY format.
UYVY format is very difficult to use, h.264 and preview components prefer yuv420. So video12 comes in handy.VEYE UYVY data from video0 ---> video12--->YUV420----->apps
video12 uses gpu resources for format conversion, which is my recommended usage.
NO.2
NO.1 is a straightforward solution, but it actually removes libcamera-apps as an off-the-shelf package, unfortunately.
Another hacking solution is to create a pipeline that uses video12, inside libcamera.
Or, modify the existing pipeline to support UYVY mode input.
It seems to me that the Raspberry Pi organization has effectively refused to do so.Of course, the above discussion is all theoretical and a long way from code.
-
@veye_xumm
The obvious advantage for support libcamera is that the app can be compatible with other cameras that support libcamera. This could become a popular choice in the future. But who know!!!Right now I can use v4l2 API to access the camera /dev/video0 with UYVY format and then convert to BGR for OpenCV processing.
I check the format for /dev/video12 with
v4l2-ctl --device /dev/video12 --list-formats
The result is:
ioctl: VIDIOC_ENUM_FMT
Type: Video Capture Multiplanar[0]: 'YUYV' (YUYV 4:2:2) [1]: 'YVYU' (YVYU 4:2:2) [2]: 'VYUY' (VYUY 4:2:2) [3]: 'UYVY' (UYVY 4:2:2) [4]: 'YU12' (Planar YUV 4:2:0) [5]: 'YV12' (Planar YVU 4:2:0) [6]: 'RGB3' (24-bit RGB 8-8-8) [7]: 'BGR3' (24-bit BGR 8-8-8) [8]: 'AB24' (32-bit RGBA 8-8-8-8) [9]: 'BGR4' (32-bit BGRA/X 8-8-8-8) [10]: 'RGBP' (16-bit RGB 5-6-5) [11]: 'NV12' (Y/CbCr 4:2:0) [12]: 'NV21' (Y/CrCb 4:2:0)
So should I access /dev/video12 in my v4l2 app and request YUV 4:2:0 or even BGR3? Will your current driver support that?
Thanks, -
@thn I think video12 is just a converter, you can't access it directly to try to get camera data.
The correct way to do this is to access video0 and get the camera data, then input this data to video12 and then read the YUV420 from video12. -
@veye_xumm
That sounds like more works than just take video0 output and convert to YUV420 or BGR directly.
Also can we use two cameras? -
@thn said in Is there any plan to support libcamera?:
Also can we use two cameras?
Of course, this has nothing to do with software architecture. The cm series of Raspberry Pi provides 2 camera interfaces.
-
@veye_xumm
A cable question, I want to test out the Raspberry Pi IO board with a CM4, but this IO board come with a 22 pins header connection instead of the 15 pin as in your camera.
Could you advise a way to connect the 22 pin header into your camera? Which converter or cable should we use?
Thanks, -
@thn
FFC22P-0.5MM-15CM-T
http://wiki.veye.cc/index.php/FFC_CableGenerally, for retail cameras, we provide a yellow ffc cable, which is the one you need.
-
@veye_xumm
I tried the cable that came in the retail package we purchased from Amazon. When I plugged the camera into the Raspberry Pi IO board with a CM4, the camera did not show up at /dev/video0 at all. This is using the very same MicroSD card to boot the Raspberry Pi 4.
I must be missing something. -
Hello,
What should I do with these dmesg output?
[ 8.850954] veyecam2m: loading out-of-tree module taints kernel.
[ 9.228770] veyecam2m 10-003b: camera id is veyecam2m
[ 9.230589] veyecam2m 10-003b: sensor is IMX385
[ 9.230616] veyecam2m 10-003b: board type is ONE board
[ 9.231135] veyecam2m 10-003b: Consider updating driver veyecam2m to match on endpoints
[ 9.231782] veyecam2m 10-003b: veyecam2m camera probed -
@thn Never mind, this can be ignored.