Pi Camera
We used the Pi Camera Module (found here). A picture of the module is below. To view the post where we got a lot of our information on the Pi Module check out this blog post:
To attach this hardware find the black clasp near the Ethernet jack and pull up on the tabs. Take the ribbon cable on the module and slid it into the clasp (making sure that the wires on the clip and cable are touching). Now press down on the tabs. Done! The module is correctly attached to the Pi. A picture for reference is below:
Next you need to enable the RasPi Camera from the Pi's configuration window. Do this by running:
And choosing this option in the configuration window:
After rebooting both update and upgrade the Pi:
To compare the streams we are going to test MJPG-Stream on the Pi Module and a USB webcam at the same time. We will not be testing the native streaming at this point because of a few disadvantages (ie. you must always be done before you tell the Pi where to stream video to). Use the links on this page to help you setup native streaming with the Raspberry Pi Camera Module. Otherwise, continue reading.
Next you have to install MJPG-Streamer. Documentation for this can be found on THIS post (or this very useful blog). After MJPG-Streamer is compiled you must make a file to which the RasPi video is copied to and then read from by MPJEG-Streamer.
First make a directory to which you can save the images:
Then make it writeable:
*****you must constantly created /tmp/stream and make it writeable or the stream will not work!
You now mush run a raspistill image capture at a very small interval. This is used for video because MJPG-Stream is only compatible with jpeg images and not the h264 video created by raspivid. The command below will have the stream capture every .1s: (for information on the meaning of these commands check out this blog post).
First make a directory to which you can save the images:
Then make it writeable:
*****you must constantly created /tmp/stream and make it writeable or the stream will not work!
You now mush run a raspistill image capture at a very small interval. This is used for video because MJPG-Stream is only compatible with jpeg images and not the h264 video created by raspivid. The command below will have the stream capture every .1s: (for information on the meaning of these commands check out this blog post).
Then run MJPG-Streamer. MJPG-Streamer will both read the pic.jpg created by raspistill and write it to a web-server.
To log onto the webserver type in the <http://ip:port> into your web browser. In this case it is <http://port:9000>. Here is an image of what you should see:
Comparision: USB and RasPi Module:
After setting up the Pi Camera module we tested it against using MJPG-Streamer and a USB webcam.
Pi Pros:
- Small!
- High quality
Pi Negs:
- SLOWER
- Easily backed up (skipping frames because it cannot write any faster than .1s
USB Pros:
- Faster
- Customizable
USB Negs:
- Larger camera
- Not as nice quality for the price
Conclusion:
We would recommend using a USB webcam for streaming live video from the Pi using MJPG-Streamer because of its fluidity compared to raspistill. The raspistill feature on the pi camera is meant for taking images and does not take them at a pace not fast enough for a robot. We have not given up on using the Pi Camera module though...stay tuned for a tutorial using the camera's native streaming software! Next time we'll compare the native streaming against MJPG-Streamer.
No comments:
Post a Comment