简体   繁体   中英

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.

For this reason I have a Raspberry pi Compute module kit, and a 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
  • OpenCV (C++) is the preferred CV package

As this is a portable application, internet based streaming is not a suitable option.

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.

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
  • Frame Rate: 15 fps
  • The cameras are 5cm apart from each other

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.

Using the standard, built-in 10/100 interface on a Raspberry Pi 2 and a Raspberry Pi 3, you can achieve 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.

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. I took a 640x480 picture on one as a JPEG - and it came out at 178,000 bytes.

Then, on the receiving Pi, I set up to receive 1,000 frames. 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:

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. So, I removed the

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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