Reading image files in VHDL

Next up in the image processing series – [reading image files in VHDL](/node/60). This allows our testbenches to operate on real image data. After this we can create a camera model which will produce the pixels and synchronisation signals like a real camera so that we can do complete image tests of a processing pipeline.

Reading image files with VHDL part 1


Please note that this page talks rubbish – [here’s why](/node/62), and [here’s a better version](/node/65).

If we’re going to do some image processing in VHDL, we’re going to need to be able to read images in to our simulations. VHDL’s file handling is pretty poor to say the least, so we’ll keep things simple by only handling a very simple file format – namely [Portable Greymap (PGM)](http://netpbm.sourceforge.net/doc/pgm.html). And for even more simplicity we’ll handle on one variant with 8-bit pixels (P2 format with Maxval<256).

Hackadayed

Inadvertently made the front page of [Hackaday](http://hackaday.com/) with the [solderless drawdio](http://hackaday.com/2010/11/09/solderless-drawdio-terminally-implemented/).

Which resulted in an order of magnitude more hits than normal before my server fell over with mysqld leaking its guts all over the console. The youtube [video of it in operation](http://www.youtube.com/watch?v=ooOPQ4h2pq0) that is also linked to from Hackaday has now had 1600+ hits!

Image processing #002

# Detecting corners

Let’s use a corner detector as an example. [Corner detection](http://en.wikipedia.org/wiki/Corner_detection) is an important image processing task: corners are good things to track over several frames of an image sequence. Once you’ve tracked them you can infer 3-d positions for them.

Change of plan – from Scilab to Octave

OK, I started out on [Scilab](http://www.scilab.org/), but got frustrated! It’s too different to [Matlab](http://www.mathworks.com/products/matlab/) – which has its flaws, but at least I’m familiar with them. I’m always going to be annoyed by the 1-based indexing of Matlab, but I’ve learned to deal with it.

Will this reduce the spam?

Thanks to [Ignacio Segura](http://www.isegura.es/blog/stop-spam-your-site-being-invisible-honeytrap-drupal-comments-form) I have a new anti-spambot measure. Users won’t notice it (unless they browse with CSS turned off, or other such unusualness). Hopefully this will mean that a) I don’t have to “disapprove” loads of comment span every day, and b) I can allow anonymous commenting without having to approve it before it becomes visible.

Image processing #001a

[Ioannis mentioned another edge detector](http://www.parallelpoints.com/node/46#comment-132) he’s fond of using – so here’s a comparison.

To summarise, his method involves shifting the image 1 pixel to the right, and subtracting it from the original image. And then doing the same but shifting one pixel down instead.

This is equivalent to convolving with

[1 -1]

rather than

[1 0 -1]
[2 0 -2]
[1 0 -1]

There’s two differences that are worth commenting on:

Published
Categorised as Uncategorised Tagged

Image processing series

I’ve begun a series of articles showing the stages of development of an image processing system. The aim is to go through from describing algorithms at a very high level in Scilab, making tradeoffs in implementation ideas, before describing the system in VHDL and comparing the results.

[Part 1 – edge detection](/node/46) is now up…

Published
Categorised as Uncategorised Tagged ,