Let's Make Robots! | RobotShop

Review: Raspberry Pi Camera Module

Take Pictures/Video, Image Processing

 

In this post I will review and go through the setup of the Raspberry Pi Camera Module. This module is great for integrating computer vision into your robot for the purpose of obstacle avoidance, line following, face recognition and even lane tracking for an autonomous robot.

Before we start here are some specs on the camera module I found on the RobotShop product page :

  • 5 megapixel OV5647 sensor in a fixed-focus module. 
  • CCD size : 1/4 inch
  •  Aperture (F) : 2.8
  •  Focal Length : 3.37 mm
  • Diagonal : 72.4 degree
  • Sensor best resolution : 1080p
  • 2592 × 1944 still picture resolution
  • Support 1080p30, 720p60 and 640x480p60/90 video record.

Enabling the Raspberry Pi Camera Module:

The advantage of the RPi Camera Module over a USB webcam is that there is no need to install drivers or any support software since the latest version of Raspbian Jessie comes with the picamera app installed. This means that the camera can be accessed using the command line. In order to enable this feature first enable the Raspberry Pi Camera Module in the raspi-config menu and reboot. This will enable you to control the module via the terminal window.

 

 

 

Taking your first picture :

Enter the command :

     raspistill -o test1.jpg


 

Here the picture will be saved in the home/pi directory and the file name will be imgtest1. Once you press enter a box will open showing the camera feed and the image will be clicked after a few seconds delay. Type ls to check that your file is saved in the home directory. Here is a screenshot where the file is highlighted :

 

 

Here is the image taken by the camera module:

 

I was very impressed by the picture quality. The picture is uotput as a Jpeg image and has a decent file size. (This particular one was around 2.5MB.)

 

Taking your first video :

Taking a video using the camera module is as easy as taking a picture. Enter the command in the terminal  as shown in the screenshot:

 

raspivid -0 vidtest.h264 -t 10000

 

For taking a video the raspivid command is used. The file will be saved as vidtest in h264 format since that is the format output by the Raspberry Pi Camera Module. This video file will be save in the home/pi directory.

The -t 10000 parameter sets the length of the video. It is given in miliseconds so 10000 would correspond to 10000 mS i.e. 10 Seconds. This parameter can be changed depending on the length of video you would want to record. The default value is 5 seconds.

I’ve had success playing the video using VLC however I’d recommend using an online mp4 converter so that sharing the video on YouTube would be possible. I have linked the video taken fom the Raspberyy Pi Camera module.

Note : There is no audio on the video since the Raspberry Pi Camera Module consists of only a camera sensor and does not have a built in microphone.

 

I also made a temporary mount for the camera module using acrylic sheet so that it can take steady pictures and video. Here are some pictures for the build:

 

 

I plan to use this module in order to build a lane-tracking and obstacle detection car  using OpenCV and Python. I will update the progress of that project in another post.I have already had luck accessing the picture and video stream of the module in OpenCV 3 after following the tutorial on Pyimagesearch. I will update this post with the projects made with the Raspberry Pi Camera module.