Finally, actually reading a PGM file in VHDL

And so, finally, [after all that setup](/node/65), some code [to read PGM files](/node/66/) and [how to make use of it](/node/67/). Next stage will be writing some files!

As always, the code can be [found on github](http://github.com/martinjthompson/image_processing_examples/hdl)

libv – assert_equal, str, etc.

The `assert_equal` functions are part of my library of useful things (maybe this could be a start towards [VHDL’s jQuery](http://www.tekphile.com/2010/12/where-is-vhdls-jquery/) :) `libv`. Why not just use `assert` as is? Well, it’s useful to report all assert results in the same fashion, particularly to include the values that you expected and what you tested, along with the difference between them – often this is useful debugging information.

Here’s an example….

Oops

It’s been very kindly pointed out to me via email (by Tricky) that I was talking complete rubbish saying that [VHDL is rubbish at 2d arrays](/node/60/).

What I should’ve said was “VHDL is rubbish at arrays of other arrays”, which is a subtle but critical difference! Arrays of other arrays are very useful (for example in register files), and the fact that the dimensions of one of the arrays must be known at compile time can make some things tricky to impossible. For example, a generic mux with a variable number of inputs can’t easily also have a generic number of bits on each input.

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.