Does raspberry pi camera V2 work with the beagley-ai

I have been trying to use the raspberry pi camera v2 with the beagleY-AI but can’t get it to capture video. I have done the IMX219 tutorial and the camera appears to be connected. However, the tutorial shows no examples of capturing video from the camera. The tutorial shows a arducam IMX219 camera being used and therefore I thought maybe the raspberry pi camera v2 is not compatible although it does use a IMX219 sensor. Has anyone used a raspberry pi camera v2 with the beagleY-AI?

I played with imx219 two months ago. The camera seems to work only as a raw device. I have these notes (no guarantees):

https://openbeagle.org/beagley-ai/beagley-ai/-/issues/5

dmesg | grep -i imx219

media-ctl -V ‘“imx219 5-0010”:0 [fmt:SRGGB8_1X8/1920x1080 field:none]’

gst-launch-1.0 -v v4l2src num-buffers=5 device=/dev/video3 io-mode=dmabuf !
video/x-bayer, width=1920, height=1080, framerate=30/1, format=rggb !
multifilesink location=“imx219-image-%d.raw”

convert -depth 8 -size 1920x1080+0 gray:imx219-image-0.raw -scale 300x out0.png

Some additional are in:

and youtube video #32 from Oleg

But for now, I’ve put the beagle aside and I’m not working with him.

2 Likes

Thank you for the help. I have now managed to capture an image with the raspberry pi V2 camera. It does appear the camera can only capture data in rggb format. I used the following to capture a colour image to a png file.

media-ctl -V '"imx219 5-0010":0[fmt:SRGGB8_1X8/640x480 field:none]'
gst-launch-1.0 v4l2src num-buffers=1 device=/dev/video3 io-mode=dmabuf ! \
video/x-bayer, width=640, height=480, format=rggb,depth=8 ! \
bayer2rgb ! videoconvert ! pngenc ! \
filesink location=image.png

I did first have to install some gstream components using

sudo apt install gstreamer1.0-plugins-bad

I did find that the image was very dark with the default camera settings. These I adjusted as follows before running the above commands.

v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl=digital_gain=200
v4l2-ctl -d /dev/v4l-subdev2 --set-ctrl=analogue_gain=2000

To get a list of parameters that can be changed use the following command

v4l2-ctl -d /dev/v4l-subdev2 --list-ctrls
2 Likes

The BeagleY-AI processor actually has a hardware JPEG encoder. I have successfully captured an image and converted to a jpeg file using the following:

media-ctl -V '"imx219 5-0010":0[fmt:SRGGB8_1X8/640x480 field:none]'
gst-launch-1.0 v4l2src num-buffers=1 device=/dev/video3 io-mode=dmabuf ! \
video/x-bayer, width=640, height=480, format=rggb,depth=8 ! \
bayer2rgb ! videoconvert ! video/x-raw,format=NV12 ! \
v4l2jpegenc ! \
filesink location=image.jpg

The image is first captured in bayer RGGB format. It is then converted to NV12 format which is suitable for the v4l2jpegenc component, that then encodes to a jpeg file.

Enjoy

1 Like