I am working on a project that aims to build a program which automatically gives a relatively accurate detection of pupil region in eye pictures. I am currently using simplecv in Python, given that Python is easier to experiment with. Since I just started, the eye pictures I am working with are fairly standardized. However, the size of iris and pupil as well as the color of iris can vary. And the position of the eye can shift a little among pictures. Here's a picture from wikipedia that is similar to the pictures I am using:
["MyStrangeIris.JPG"](https://commons.wikimedia.org/wiki/File:MyStrangeIris.JPG) by Epicstessie is licensed under [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/deed.en)

I have tried simple thresholding. Since different eyes have different iris colors, a fixed thresholding would not work on all pictures.

In addition, I tried simplecv's build-in sobel and canny edge detection, it's not working especially for eyes with darker iris. I also doubt that sobel or canny alone can solve the problem, given sometimes there are noises on the edge of the pupil (e.g., reflection of eyelash)

I have entry-level knowledge about image processing and machine learning. Right now, I am thinking about three possibilities: 

1. Do a regression on the threshold value base on some variables
2. Make a specific mask only for edge detection for the pupil
3. classification on each pixel (this looks like lots of work to build the training set)

Am I on the right track? I would like to reach out to anyone with more experience on this type of problem. Any tips/suggestions are more than welcome. Thanks!