question in use img.findcircle() to find the iris

Hi , I have an idea to use openmv to make a eye-tracker,but encounter difficulties in find the iris. here is the code, it’s seems that iris can’t not be found using the way of img.findcircle(),but find the left area of eye instead(the white of the eye),or it may be something wrong the parameter i take?

import sensor, time, image

# Reset sensor

# Sensor settings

# Set resolution to VGA.

# Bin/Crop image to 200x100, which gives more details with less data to process
sensor.set_windowing((220, 190, 200, 100))


# Load Haar Cascade
# By default this will use all stages, lower stages is faster but less accurate.
eyes_cascade = image.HaarCascade("eye", stages=24)

# FPS clock
clock = time.clock()

while (True):
    # Capture snapshot
    img = sensor.snapshot()
    # Find eyes !
    # Note: Lower scale factor scales-down the image more and detects smaller objects.
    # Higher threshold results in a higher detection rate, with more false positives.
    eyes = img.find_features(eyes_cascade, threshold=0.5, scale_factor=1.5)
    # Find iris
    for e in eyes:
        for c in img.find_circles(e,threshold = 1500, x_margin = 8, y_margin = 8, r_margin = 10,r_min = 1, r_max = 10, r_step = 1):
            img.draw_circle(c.x(), c.y(), c.r(), color = (148, 0, 0))
            print('find iris')
        img.draw_cross(e[0], e[1])
        pupil = img.find_eye(e)
        img.draw_cross(pupil[0], pupil[1])

Hi, does the find_features() method find the eyes first? Please verify that part works.

Yeah, the find_features() method can find the eyes sometimes, actually the find_circle method can find the cr(the white spot reflect by the irlight),but can’t find iris,just show like this

, i set the findcircle() r_max parameter bigger,and the circle it detect is wrong like this

, if you have any advise sugguest?

By the way, I also try to use openmv to make a model of Venous visualization,but get troble in the edge extraction using the canny or morph demo

, is there any way for i to write my own algorithm like niblack for openmv?

thanks for your reply
best wishes

Yes, if you download the build system and tweak anything:

Let me know once you get it installed and I’ll walk you through how to add customs methods to the python user interface level.