Raspberry PI / OpenCV Tips

The Raspberry PI is a very small computing device where typically you are adding some sort of external device like a video camera, motor, etc.  This requires the the devices the OS, the libraries, we use to have to interact with each other and having the Raspberry PI and not configured properly can lead to a very unstable system.  The following section are my tips and notes of my experiences in working with this device.  Hope someone finds them useful.

OpenCV and the Raspberry PI Camera

When using the OpenCV library you can't seem to get it to read the camera port, eventhough raspivid and raspistill works.  The symptom is 

(grabbed, frame) = stream.read()

where grabbed = false

A likely issue is the following.

In order for OpenCV library to properly communicate with the Raspberry PI camera it expect the v4l2 driver to be loaded.  You can verify this by looking if /dev/video to be present.  If not executing the command below should load it.

sudo modprobe bcm2835-v4l2

VNC Server not displaying raspivid or opencv previews

This was so difficult to solve.  The answer for me was.

1. Enable Direct Capture
2. Realize that this will result in all previews being display on vncserver session :0 at port 5900

I would run my vnc session on 5901 and could never see the output.  I kept thinking the direct capture was not enabled properly.  It was, the output was going to port 5900.

Next thing is fix the screen resolution on VNC.  Follow the directions on VNC site.

Changing VNC Resolution for port 5900

00
Days
00
Hours
00
Minutes
00
Seconds

Watch AI in action.  Click HERE to learn more