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)]( And for even more simplicity we’ll handle on one variant with 8-bit pixels (P2 format with Maxval<256).


Inadvertently made the front page of [Hackaday]( with the [solderless drawdio](

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]( 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]( 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](, but got frustrated! It’s too different to [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]( 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]( 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:

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…

Categorised as Uncategorised Tagged ,