A variety of other filters can be used in order decrease the extraneous data found in the edge detection stage. The first step in cleaning up the image is to dilate all the edge detected lines. By increasing the size of the lines nearby edge detected components are likely to coalesce into a larger line segment. In this way complete edges not fully linked by the edge detector can form. Thus the dilation will give us a higher probability that the perimeter of the pupil is a complete circle.
Knowing that the pupil is well defined more filters can be used without fear of throwing out that important information. Assuming the image is centered a filter can be used to fill in the circle defined by the pupil's perimeter. In this way we clearly define the entire area of the pupil. After this, a filter which simply throws out sections of connected pixels with an area below a threshold can be used effectively to throw out smaller disconnected parts of the image the edge detector found. Finally, any holes in the pupil caused by reflections or other distortions can be filled, by looking for sections of blank pixels with an area below a threshold. After this processing we achieve a picture that highlights the pupil area while being fairly clean of extraneous data.