Line 418: |
Line 418: |
| | | |
| ===== 实时预览 ===== | | ===== 实时预览 ===== |
| + | |
| + | ====== 使用gstreamer预览UYVY格式图像 ====== |
| <code>export DISPLAY=:0</code> | | <code>export DISPLAY=:0</code> |
| | | |
| 为了方便进行安装和调试,MV系列相机提供了UYVY模式。UYVY模式支持的最大宽度为2880,使用如下命令可以进行实时预览。 | | 为了方便进行安装和调试,MV系列相机提供了UYVY模式。UYVY模式支持的最大宽度为2880,使用如下命令可以进行实时预览。 |
− | ======install gstreamer======
| + | |
| + | * install gstreamer |
| + | |
| <code>sudo apt-get install gstreamer1.0-tools</code> | | <code>sudo apt-get install gstreamer1.0-tools</code> |
| | | |
Line 427: |
Line 431: |
| | | |
| <code>sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-ugly gstreamer1.0-tools gstreamer1.0-gl gstreamer1.0-gtk3</code> | | <code>sudo apt-get install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-ugly gstreamer1.0-tools gstreamer1.0-gl gstreamer1.0-gtk3</code> |
− | ====== MV-MIPI-IMX178M======
| + | |
| + | * MV-MIPI-IMX178M |
| + | |
| <code>v4l2-ctl -d /dev/video0 --set-fmt-video=width=2816,height=2064,pixelformat=UYVY</code> | | <code>v4l2-ctl -d /dev/video0 --set-fmt-video=width=2816,height=2064,pixelformat=UYVY</code> |
| | | |
| <code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)2816, height=(int)2064, framerate=(fraction)22/1" ! v4l2convert ! "video/x-raw,format=(string)NV12" ! autovideosink sync=false -v</code> | | <code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)2816, height=(int)2064, framerate=(fraction)22/1" ! v4l2convert ! "video/x-raw,format=(string)NV12" ! autovideosink sync=false -v</code> |
− | ======MV-MIPI-SC130M, MV-MIPI-IMX296M, MV-MIPI-IMX265M,MV-MIPI-IMX264M,MV-MIPI-IMX287M======
| + | |
| + | * MV-MIPI-SC130M, MV-MIPI-IMX296M, MV-MIPI-IMX265M,MV-MIPI-IMX264M,MV-MIPI-IMX287M |
| + | |
| <code>v4l2-ctl --set-selection=target=crop,top=0,left=0,width=$WIDTH,height=$HEIGHT</code> | | <code>v4l2-ctl --set-selection=target=crop,top=0,left=0,width=$WIDTH,height=$HEIGHT</code> |
| | | |
Line 437: |
Line 445: |
| | | |
| <code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)$WIDTH, height=(int)$HEIGHT,framerate=(fraction)$FPS/1" ! v4l2convert ! "video/x-raw,format=(string)NV12" ! autovideosink sync=false -v</code> | | <code>gst-launch-1.0 v4l2src device=/dev/video0 ! "video/x-raw,format=(string)UYVY, width=(int)$WIDTH, height=(int)$HEIGHT,framerate=(fraction)$FPS/1" ! v4l2convert ! "video/x-raw,format=(string)NV12" ! autovideosink sync=false -v</code> |
| + | |
| + | ====== 使用opencv调用GREY格式图像 ====== |
| + | |
| + | * install opencv |
| + | |
| + | <code>pip uninstall opencv-python</code> |
| + | |
| + | <code>sudo apt install python3-opencv</code> |
| + | |
| + | * 我们提供了一个简单的[https://github.com/veyeimaging/raspberrypi_v4l2/tree/main/samples/opencv/raw_camera sample]实现此功能: |
| + | |
| + | <code>python ./v4l2dev_2_opencv_show_grey.py --width 640 --height 480 --fps 30</code> |
| | | |
| ==== 触发模式 ==== | | ==== 触发模式 ==== |