BPi-M2 Zero Armbian+ OV5640 + OpenCV SD image

We have created a SD image for the BananaPi M2 Zero with a working OV5640 camera.

armbian Included:

  • Armbian_21.02.1_Bananapim2zero_buster_current_5.10.12_desktop.img.xz
  • OV5640 Camera
  • BPI-WiringPi2
  • OpenCV 4.5.4
  • Code::Blocks16.01

BananaStreet

Now you can stream live video to OpenCV for further processing. Examples are included
Up to 1280x720 @ 30 FPS via UDP GStreamer.

OV5640

You can find the SD image at GitHub
Login: pi
Password: pass1234

Enjoy!

1 Like

very good . hope you can show more about banana pi.

not working and another 20 chars … just to satisfy the rules.

What is not working? The whole OS, or just the camera interface. Don’t forget to initialize the camera before use. See: https://github.com/Qengineering/BananaPi-M2-Zero-OV5640/issues/2

Your image is very large. Downloading broken after some time (1.5-2 Gb) and resume loading not available.

Can you splitting your image? Thanks)

I’ve placed a 7z splitted version (12x 500 MB) on the GitHub repo.

1 Like

Ou! Very big thanks!

Is it possible to connect such device wth wide angle lenz?

I think so. It seems to be the same connector, and, indeed, it says OV5640. So give it a try.

Hello friend :slight_smile: I show pin description of this 5640 sensor (200 degree) and Schematic diagram of M2 Zero device. And I reworking fpc-24 connector. And I understanding what this very bad solve and better to buy ready-made reverse flat cable.DSCN2713 My dmesg such as:

pi@banana:~$ dmesg |grep 5640
[    7.668127] sun6i-csi 1cb0000.camera: creating ov5640 2-003c:0 -> sun6i-csi:0 link

And new video device was apeared:

pi@banana:~$ ls /dev/video*
/dev/video0  /dev/video1

And v4l2 knows about camera device:

pi@banana:~$ v4l2-ctl --list-devices
sun6i-csi (platform:camera):
	/dev/video1

cedrus (platform:cedrus):
	/dev/video0

And I launching this command as speak your nice instruction:

sudo media-ctl --device /dev/media1 --set-v4l2 '"ov5640 2-003c":0[fmt:YUYV8_2X8/1280x720]'

But my capture result is bad with broken pipe:

pi@banana:~$ ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video1 output.mkv
ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --arch=arm --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[video4linux2,v4l2 @ 0x1cb7210] The driver changed the time per frame from 1/25 to 1/30
[video4linux2,v4l2 @ 0x1cb7210] ioctl(VIDIOC_STREAMON): Broken pipe
/dev/video1: Broken pipe
pi@banana:~$ 

And other v4l2 commands also generate ioctl error message

pi@banana:~$ ffmpeg -f video4linux2 -input_format mjpeg -i /dev/video1 out.mov
ffmpeg version 4.1.6-1~deb10u1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 8 (Debian 8.3.0-6)
  configuration: --prefix=/usr --extra-version='1~deb10u1' --toolchain=hardened --libdir=/usr/lib/arm-linux-gnueabihf --incdir=/usr/include/arm-linux-gnueabihf --arch=arm --enable-gpl --disable-stripping --enable-avresample --disable-filter=resample --enable-avisynth --enable-gnutls --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libcaca --enable-libcdio --enable-libcodec2 --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libgme --enable-libgsm --enable-libjack --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libpulse --enable-librsvg --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libssh --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzmq --enable-libzvbi --enable-lv2 --enable-omx --enable-openal --enable-opengl --enable-sdl2 --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-chromaprint --enable-frei0r --enable-libx264 --enable-shared
  libavutil      56. 22.100 / 56. 22.100
  libavcodec     58. 35.100 / 58. 35.100
  libavformat    58. 20.100 / 58. 20.100
  libavdevice    58.  5.100 / 58.  5.100
  libavfilter     7. 40.101 /  7. 40.101
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  3.100 /  5.  3.100
  libswresample   3.  3.100 /  3.  3.100
  libpostproc    55.  3.100 / 55.  3.100
[video4linux2,v4l2 @ 0x23501e0] ioctl(VIDIOC_STREAMON): Broken pipe
/dev/video1: Broken pipe
pi@banana:~$ 

How I understand what I can or can’t to recieve video or image capture from this camera sensor?

There is a mismatch between the command(=> 1280x720)

sudo media-ctl --device /dev/media1 --set-v4l2 '"ov5640 2-003c":0[fmt:YUYV8_2X8/1280x720]'

and (=> 680x480)

ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video1 output.mkv

Both need to be of the same frame size.

Ou, very big thanks :smiley: I recieved test video with this!!))