ImageProcessing with your Raspberry Pi

This is a very simple example of how you can do basic image processing on a Raspberry Pi. The following takes
two pictures using the Raspberry Pi camera, and takes them about 1 second apart:

image1 = DeviceRead["RaspiCam"];
Pause[1];
image2 = DeviceRead["RaspiCam"];

Next you can display the individual images. In my case I took a picture of the ceiling and windows of my office first and then without moving the camera I hovered my hand in front of the camera for the second picture:

{ image1, image2 }


Next I use the ImageDifference function to subtract the second image from the first one. This causes most of the image to become black, since most of the two images are the same. The only difference is the part where my hand appeared since this is different between the images:

image3 = ImageDifference[image1,image2]

2 Likes

DeviceRead[“RaspiCam”] is hanging in the current release (in NOOBS / Raspbian)

It looks like raspistill no longer works with ‘-t 0’ (a zero millisecond delay). I made a patched file here (using a 1 millisecond delay):

https://download.wolfram.com/?key=ZNGB5F

You can download that file and use it to replace RaspiCam.m in:

/opt/Wolfram/WolframEngine/10.0/SystemFiles/Devices/DeviceDrivers

I get an error Import::fmterr : Cannot iport data as JPEG format - regardless of delay setting under Raspbian

1 Like