1

The requirement is to create an Android application running on one specific mobile device that records video of a human eye pupil dilating in response to a bright light (which is physically attached to the mobile device). The video is then post-processed frame by frame on the device to detect & measure the diameter of the pupil AND the iris in each frame. Note the image processing does NOT need doing in real-time. The end result will be a dataset describing the changes in pupil (& iris) size over time. It's expected that the iris size can be used to enhance confidence in the pupil diameter data (eg removing pupil size data that's wildly wrong), but also as a relative measure for how dilated the eye is at any point.

I am familiar with developing Android mobile apps, but my experience with image processing is very limited. I've researched solutions and it seems that the answer may lie with the OpenCV/JavaCv libraries, which should provide shape detection (eg http://opencvlover.blogspot.co.uk/2012/07/hough-circle-in-javacv.html) but can anyone provide guidance on these specific questions:

Am I right to think it can detect the two circle shapes within a bitmap, one inside the other? ie shapes inside each other is not a problem.

Is it true that JavaCv can detect a circle, and return a position & radius/diameter? ie it doesn't return a set of vertices that then require further processing to compare with a circle? It seems to have a HoughCircle method, so I think yes.

What processing of each frame is typically used before doing shape detection? For example an algorithm to enhance edges, smooth, or remove colour?

Can I use it to not just detect presence of, but measure the diameter of the detected circles? (in pixels, but then can easily be converted to real-world measurements because known hardware is being used). I think yes, but would be great to hear confirmation from those more familiar.

This project is a non-commercial charitable project, so any help especially appreciated.

Video frame sample

Ollie C
  • 28,313
  • 34
  • 134
  • 217
  • Yes, you can do this with OpenCV. 1) I strongly recommend to use [OpenCV official Java wrappers](http://docs.opencv.org/2.4/doc/tutorials/introduction/desktop_java/java_dev_intro.html) instead of JavaCV. Or even better code in C++. 2) HoughCircles may be the correct approach, but take care that it isn't able to find concentric circles. You need to take care of this by yourself (a lot of examples on SO, e.g. [here](http://stackoverflow.com/a/32287930/5008845)). – Miki Mar 21 '16 at 13:10
  • 3) The results of HoughCircles will be a set of circles, each one defined by the 3 parameters (x, y, radius) 4) There's no magic rule for preprocessing... Please post a few images (without the arrows) to get a better idea. – Miki Mar 21 '16 at 13:12

1 Answers1

0

I would really suggest using ndk as it is a bit richer in features. Also it allows you to run and test your algorithms on a laptop with images before pushing it to a device, speeding up development.

Pre-processing steps: Typically one would use thresholding or canny edge detection and morphological operations like erode dilate.

For detection of iris / pupil, houghcircles is not a very good method, feature detection methods like MSER work better for not-so-well-defined circles. Here is another answer I wrote on the same topic which has code that could help.

If you are looking to measure the regions, I would suggest going through this blog. It has a clear explanation on the steps involved for a reasonably accurate measurement.

Community
  • 1
  • 1
Vasanth
  • 1,238
  • 10
  • 14