2. Camera¶
Hardware interface
2.1. MIPI CSI¶
RK3576 platform has one DCPHY and two DPHY. DPHY can work in two modes: full mode and split mode; DCPHY only has full mode.
In short, if we use single-camera, we can set dphy to full mode, if we use dual-camera, we can set dphy to split mode.
ROC-RK3576-PC only exported one DPHY
2.2. Full Mode Configuration¶
Link path: csi2_dphy0 –> mipi1_csi2 –> rkcif_mipi_lvds1
Check device tree: rk3576-roc-pc-cam-8ms1m.dtsi for details.
2.3. Camera Debug¶
Use v4l2-ctl to capture camera frame data
v4l2-ctl --verbose -d /dev/video0 --set-fmt-video=width=1920,height=1080,pixelformat='NV12' --stream-mmap=4 --set-selection=target=crop,flags=0,top=0,left=0,width=1920,height=1080 --stream-to=/data/out.yuv
Copy file out.yuv to ubuntu to play
ffplay -f rawvideo -video_size 1920x1080 -pix_fmt nv12 out.yuv
2.4. Android Use Camera App¶
In addition to the official default supported cameras, To open camera with camera app in Android needs configuring in camera3_profiles*.xml. For details please refer to files in Android SDK under hardware/rockchip/camera/etc/camera
.
2.5. Linux Preview Camera¶
Ubuntu firmware can use this script to view camera stream:
#!/bin/bash
export DISPLAY=:0.0
export XDG_RUNTIME_DIR=/run/user/1000
echo "Start MIPI CSI Camera Preview!"
gst-launch-1.0 v4l2src device=/dev/video0 ! queue ! video/x-raw,width=800,height=600 ! videoconvert ! xvimagesink