Difference between revisions of "CS-MIPI-X for Raspberry Pi"

From wiki_veye
Jump to navigation Jump to search
Line 31: Line 31:
 
*Go to the main menu and open the Raspberry Pi Configuration tool. Enable ''Camera'' and ''I2C'' interface.
 
*Go to the main menu and open the Raspberry Pi Configuration tool. Enable ''Camera'' and ''I2C'' interface.
  
<code>sudo raspi-config</code>[[File:Veye-Raspi-config.png|center|thumb|600x600px|link=http://wiki.veye.cc/index.php/File:Veye-Raspi-config.png]]
+
<code>sudo raspi-config</code>[[File:Veye-Raspi-config.png|center|thumb|600x600px]]
  
 
*Enable SSH  and Samba services.
 
*Enable SSH  and Samba services.
  
 
<br />
 
<br />
 +
 
===Sofware Toolkits Install===
 
===Sofware Toolkits Install===
 
====Toolkits downloading====
 
====Toolkits downloading====

Revision as of 09:09, 12 June 2020

查看中文

How to Use CS-MIPI-X Mipi Camera with Raspberry Pi

1 Introduction

CS-MIPI-307 is a is a special camera module which is compatible with RASPBERRY PI. It use SONY STARVIS sensor——IMX307 and has excellent ISP functions build-in.The output format is stanard UYVY stream. It is very easy to use it with RASPBERRY PI.Of course, she also has some subtle differences with the official version. She support 1080p@30,720p@60 resolution,and i2c cmd is different.

Theoretically,VEYE Camera Modules support all Raspberry Pi. For performance reasons, I recommend you use 3,3+,4 version. This article uses Raspberry Pi 4 as an example to explain how the CS-MIPI-307 camera module working with Raspberry Pi. It also explain the specials of RPI Computer Module and Zero using VEYE Camera Module.

2 Hardware Setup

Essentials You Need:

  • Raspberry PI Items : RPI, Network, MicroSD Card, Power, Monitor
  • Camera Module Items : CS-MIPI-307,FFC,Dupont Wire,Lens.

Setup guide

  • Connect the VEYE Camera Module the CSI-2 port using FFC Cable(type B).
  • Connect Dupont Wire as shown below. CS-MIPI-307 need an addtional power.
  • Startup RaspberryPi.
connect CS-MIPI-IMX307 to Raspberry Pi 001
connect CS-MIPI-IMX307 to Raspberry Pi 002


connect CS-MIPI-IMX307 to Raspberry Pi 003
connect CS-MIPI-IMX307 to Raspberry Pi 004
connect CS-MIPI-IMX307 to Raspberry Pi 005


3 RaspberryPi System Setup and Configuration

  • Setup RasapberryPi System,reference this link.
  • Go to the main menu and open the Raspberry Pi Configuration tool. Enable Camera and I2C interface.

sudo raspi-config

Veye-Raspi-config.png
  • Enable SSH and Samba services.


4 Sofware Toolkits Install

4.1 Toolkits downloading

There are two way to install software toolkits.

  • 1. Clone from github

git clone https://github.com/veyeimaging/raspberrypi.git

  • 2. Downloading from github (link here), upload to RPI using samba or USB disk.

4.2 Toolkits Overview

Software Tookits on github

Software toolkits contains threeparts. veye_raspcam is raspcam alike Video Stream Toolkits, D_mipi_rpi is D-SDK Video Stream Toolkits, i2c_cmd is Video Control Toolkits.

  • Video Stream Tookkits provides real-time display, capture, video recording, etc.
  • Video Control Toolkits is a shell script which provides ISP parameters configuration capbility.
  • Both is Open Source.

Note: D-SDK do not support 720p@60 now! will upgrade soon!

5 Video Stream Toolkits Manual

5.1 Video format

veye type like Video Stream Toolkits support multiple video formats,such as 1080p@30fps,720p@60fps etc..

-md option indicat which format to use,default 0。

Please set the video format before using Video Stream Toolkits.

Video Formats
Value Video Format
0 1080p@30fps
1 720p@60fps
2 VGA@130fps

5.2 veye_raspcam: raspcam alike toolkits

cd raspberrypi/veye_raspcam/bin/

chmod +x *

VS toolkits provides several ELF file.

  • veye_raspipreview

./veye_raspipreview -md 1 -t 20000 -p '0,0,1280,720'

Dispaly real-time video(720p@60) to HDMI output,preview window is 1280*720, last 20 seconds.

./veye_raspipreview -t -1

If t is -1, Show continuous Real-time display to HDMI output,full screen.

  • veye_raspivid

./veye_raspivid -md 1 -t 5000 -o ~/test.h264

Implement H.264 format encoding(720p@60) and record for 5 seconds,Record the stream data to file ~/test.h264.

At the same time,Dispaly real-time video to HDMI output.(use -n if you do not want preview)

  • veye_raspivid (direct tcp stream with netcat,gstreamer etc..)

RPI side

./veye_raspivid -b 4000000 -t 0 -o - | nc -l -p 5000

H.264 encoding on bitrate 4Mbps,forever,listen on TCP port 5000.

PC side,using gstreamer(Powershell recommended)

./gst-launch-1.0 -v tcpclientsrc host=x.x.x.x port=5000 ! decodebin ! autovideosink

x.x.x.x is RPI IP address

gstreamer windows version download.

PC side, using mplayer

./mplayer -x 1280 -y 720 -geometry 0:0 -fps 200 -demuxer h264es -noborder ffmpeg://tcp://x.x.x.x:5000

x.x.x.x is RPI IP address

mplayer for windows download

  • veye_raspividyuv

./veye_raspividyuv -t 200 -o /dev/shm/test.yuv

Record UYVY data to file /dev/shm/ directory(which is in DDR), time is 200ms.

  • veye_raspiraw

./veye_raspiraw -md 2 -t 200 -o /dev/shm/out.%04d.yuv

Record one UYVY data to file /dev/shm/ directory(which is in DDR).

  • veye_raspstillyuv

./veye_raspistillyuv -md 1 -o /dev/shm/test.yuv

Capturing one image and save to /dev/shm directory(which is in DDR).1280*720 YUV420 I420 format.

./veye_raspistillyuv -tl 50 -t 1000 -o /dev/shm/test%d.yuv

Capturing one image every 50 milliseconds and save to /dev/shm directory(which is in DDR).1920*1080 YUV420 I420 format.

  • veye_raspistill

./veye_raspistill -md 1 -o ~/test.jpg

Capturing one image and save to home directory.1280*720 JPG format.

./veye_raspistill -e bmp -tl 50 -t 1000  -o /dev/shm/test%d.bmp

Capturing one image every 50 milliseconds and save to /dev/shm directory(which is in DDR).1920*1080 BMP format.

./veye_raspistill -k -o ~/test%d.jpg -t 0

Display video to HDMI,capture jpg image using keyboard,Enter to capture,X Enter to quit.

veye_raspistill support preview,-n will not preview.

5.3 D-SDK Toolkits Manual

Please refer VEYE-MIP-327 D-SDK part

6 Video Control Toolkits Manual

On Raspberry Pi, We use I2C-0 as control bus for VEYE Camera Module. We provide a Shell Script — camera_i2c_config— to config pin usage.

Video Control Toolkits Manual : CS-MIPI-X i2c