One of the coolest things I've gotten to do at my current job is image analysis and feature extraction. The goal of one of our projects was to isolate single fly embryos from images taken from labs. Doing it is pretty simple and requires very little advanced mathematics, but to do it well, it takes some advanced pixel manipulation.

The Requirements

The Solution

An Example

- Make the image grayscaled.

- Apply a threshold on it to only get the dark areas. This assumes the lines will always be near black.

- Apply a Particle Analyzer to find Ellipses on the image.

- Loop through the "Particles" to find ones that fit our criteria.

- Get the angle from our Particle.

The major requirement was that the application be available on Mac, Linux, or PC; thus, we chose Java as our language. Likewise, all components of the application needed to be in Java.

Before I had arrived to the group, someone had already rewritten some MATLAB code that was able to extract embryo images from laboratory photos; and so the first step was that the Java code be able to reproduce the results from the MATLAB code. Originally, we had investigated the possibility of simply using the MATLAB code and distributing that, but not every one has MATLAB (especially with its price tag). We then found out about a MATLAB to Java compiler that did little more than just wrap the MATLAB code in a class; in fact, you still needed to have the MATLAB environment running, and on top of that, you needed to recompile the Java code for all platforms you wanted to distribute the application on. It was a horrible mess, so we quickly dismissed MATLAB as the means of distributing the code, and thus, it was agreed that all MATLAB code would need to be rewritten in Java.

http://stackoverflow.com/q/11461910/759316

The question was asked "How do I get the angle of these black bars?"

How the code works:

- Make the image grayscaled.
- Apply a threshold on it to only get the dark areas. This assumes the lines will always be near black.
- Apply a Particle Analyzer to find Ellipses on the image.
- Loop through the "Particles" to find ones that fit our criteria.
- Get the angle from our Particle.

## 0 comments:

## Post a Comment