Image Processing Set Up

I am working towards doing some image processing using the mbed. But before this can take place I need to set up a few things first.

Step 1 - Capture Images

The first thing is get some images. This could be done by storing images on an SD Card but I want to form a computer vision system so I opt to work with a camera.

I have already done this as detailed here using a module available from 4D Systems

Step 2 - Display Captured Images

I did do this on a small OLED display in the uCam development page but I want a bigger display! I thought it would be good to display the original image and then its transforms on the same screen for comparison.

To this end I got hold of a new bigger QVGA TFT display, which has a great library written by Peter Drescher.

So I just need to write a small program to take a picture and display it on the screen.

This was not too difficult, but I did have to display each pixel individually using the pixel method because I didn't want to spend the extra time to get the bitmap method working from the 2-byte data format used by the uCam module. This is somewhat slower than using the bitmap method but still displays an image in around 30 ms, which I can live with.

Step 3 - External Memory

This is where I run into the first problem. The image needs to stored somewhere for the transforms to be carried out and the mbed can only store arrays with <22k elements (it runs of of RAM). So images bigger than 160 x 120 pixels (19.2k elements) can't be stored and multiple images are also impossible.

I used some external memory that Romilly Cocking had written a library for (many thanks), of which a sample program can be found below.

Import programSer23K256

Library to drive the Microchip 23K256 SRAM over SPI.

This is where I run into my 2nd problem - size. I thought that 256k would mean 256,000 bytes (or 262,144 bytes depending on how they define 1k) of memory. It doesn't. The storage in this chip (and every chip like it!) is 262,144 bits, or 32k.

This really messed me up as I can't even store a single 120*160 16-bit image (which takes 38,400 bytes) on this chip!

Step 4 - Memory Bank

The solution here was to wire up multiple SRAM ICs on the same SPI bus and tie multiple Ser23K256 objects into a single object that manages the memory. In other words I wrote a memory bank class. This allowed me to address much more memory and store more than 1 image.

Step 5 - Process Images!

OK so the set-up is kinda done. I can take images with the uCam camera and store them in memory and display the images on a screen.

The next step is to develop a library that gives basic image processing methods.


Please log in to post comments.