简体   繁体   English

将实时摄像头馈送从RPI计算模块流式传输到RPI 3

[英]Stream live camera feed from RPI compute module to RPI 3

I'm developing a portable hardware/software application to use 2 cameras in a stereo vision configuration, and process the raw data for information to output. 我正在开发一个便携式硬件/软件应用程序,以在立体视觉配置中使用2个摄像机,并处理原始数据以输出信息。

For this reason I have a Raspberry pi Compute module kit, and a Raspberry pi 3. 因此,我有一个Raspberry pi Compute模块套件和一个Raspberry pi 3。

  • The compute module kit will operate the two cameras 计算模块套件将操作两个摄像机
  • The pi 3 will run the code as it has the computational power pi 3将运行代码,因为它具有计算能力
  • OpenCV (C++) is the preferred CV package OpenCV(C ++)是首选的CV软件包

As this is a portable application, internet based streaming is not a suitable option. 由于这是便携式应用程序,因此不适合使用基于Internet的流传输。

I've not had time to play around with the GPIO pins, or find a method of streaming the two camera feeds from the compute module to the pi 3. 我没有时间玩GPIO引脚,也没有找到将两个摄像机源从计算模块流到pi 3的方法。

How would you suggest I proceed with this? 您如何建议我继续进行? Has anyone performed such a project? 有人进行过这样的项目吗? What links can you provide to help me implement this? 您可以提供哪些链接来帮助我实现这一目标?

This is for a dissertation project, and will hopefully help in the long run when developing as a full prototype. 这是一个学位论文项目,希望在作为一个完整的原型开发时从长远来看会有所帮助。

  • Frame Size: 640x480 画面尺寸:640x480
  • Frame Rate: 15 fps 帧率:15 fps
  • The cameras are 5cm apart from each other 相机彼此相距5厘米

Updated Answer 更新的答案

I have been doing some further tests on this. 我一直在对此做一些进一步的测试。 Using the iperf tool and my own simple TCP connection code as well, I connected two Raspberry Pis directly to each other over wired Ethernet and measured the TCP performance. 我还使用iperf工具和我自己的简单TCP连接代码,通过有线以太网将两个Raspberry Pi相互直接连接,并测量了TCP性能。

Using the standard, built-in 10/100 interface on a Raspberry Pi 2 and a Raspberry Pi 3, you can achieve 94Mbits/s. 在Raspberry Pi 2和Raspberry Pi 3上使用标准的内置10/100接口,您可以达到94Mbits / s。

If, however, you put a TRENDnet USB3 Gigabit adaptor on each Pi, and repeat the test, you can get 189Mbits/s and almost 200 if you set the MTU to 4088. 但是,如果在每个Pi上放置一个TRENDnet USB3千兆适配器,然后重复测试,则将MTU设置为4088,则可以达到189Mbit / s,几乎可以达到200 Mb / s。

Original Answer 原始答案

I made a quick test - not a full answer - but more than I can add as a comment or format correctly! 我进行了快速测试-不是完整的答案-但超过了我可以添加为注释或正确格式的范围!

I set up 2 Raspberry Pi 2s with a wired Ethernet connection. 我通过有线以太网连接设置了2个Raspberry Pi 2s。 I took a 640x480 picture on one as a JPEG - and it came out at 178,000 bytes. 我将一张640x480的图片作为JPEG格式拍摄了出来,结果为178,000字节。

Then, on the receiving Pi, I set up to receive 1,000 frames. 然后,在接收Pi上,我设置为接收1,000帧。 Like this: 像这样:

#!/bin/bash
for ((i=0;i<1000;i++)); do
   echo $i
   nc -l 1234 > pic-${i}.jpg
done

On the sending Pi, I set up to transit the picture 1,000 times: 在发送Pi上,我设置为将图片传输1000次:

for ((i=0;i<1000;i++)) ; do nc 192.168.0.65 1234 < pipic1.jpg ;done

That took 34 seconds, so it does 33 fps roughly but it stuttered a lot because of writing to the filesystem and therefore SD card. 这花了34秒,所以它的速度大约为33 fps,但是由于写入文件系统以及SD卡而使其停顿了很多。 So, I removed the 因此,我删除了

nc -l 1234 > pic-${i}.jpg nc -l 1234> pic-$ {i} .jpg

and didn't write the data to disk - which is what you will need as you are writing to the screen, as follows: 并且没有将数据写入磁盘-这是您在写入屏幕时所需要的,如下所示:

nc -l 1234 > /dev/null

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM