Thursday, January 21, 2010

Viewing binary data as an image

So, I have a stream of data from a FireWire device I need to interpret as an image. I'll not get into the how or why of this, but the problem is pretty simple: take a file which is 250,848 bytes long, with each byte representing the 8-bit grayscale intensity of a single pixel in a 536 x 458 pixel image, and reconstruct that image.

Turns out, finding an app to do this is a non-trivial problem. Sure, I could write something to do it (in the past, I've written a Scilab script that plots it, but that takes a lot of memory, runs slowly, and generally gives me few or no tools to deal with the "image" resulting, besides my eyes), but I KNOW this is a solved problem (my favorite term of late) and anything I came up with would likely be a south-pointing chariot.

In the end, I turned to my old friend, ImageJ. ImageJ is a powerful, free, Java-based image manipulation and analysis tool. It's no replacement for GIMP or Photoshop, but it provides a very simple interface to analyze images. Sure enough, ImageJ includes a provision to import "raw" image data- exactly what I needed.

Hopefully, someone, someday, will find this blog post on a Google search and it'll save them some time.

No comments:

Post a Comment