Matlab Code For Eye Color Detection

by admin in , , on July 22, 2020
  • gallery-image
  • gallery-image
  • gallery-image


This code is intended to discover the eyes color, the code can detect the common eye colors like blue, green, brown, black, and hazel eyes. The code contains a User interface UI that makes it easy for the user to use the code.

Code input: a picture that contains the upper part (shoulders and head or just head) of any person.

Code output: Detecting the Eye position with writing the eyes color.


Eye Detection

The code first determines the eyes position with the help of Matlab vision toolbox and then extract the eyes color and compare it with the predefined colors in the code.


Color Detection

After detecting the eyes the code compares it with the predefined colors blue, green, brown, black, and hazel eyes and then shows the result written in the text field.

For each color, there are three ranges of the threshold have been saved for it in the code, red low threshold to red high threshold, blue low threshold to blue high threshold, green low threshold to green high threshold. when the extracted triple color (red, green, blue) from the eye lies in the threshold ranges, the eye color directly detected and recognized.


Examples to Try:



  • The code is robust in detecting the eye color.
  • The code is open for the future modifications so you can add more variants of the eyes color.
  • Writing in simple language and with the fewer lines as possible


  • If there are glasses on the eyes the code might not work correctly and shows error in the workspace.

See the Video:

You might be interested in:


0 Sale

Share Now!

Release Information

  • Price


  • Released

    July 22, 2020

  • Last Updated

    July 22, 2020

  • File Included

    All files shown in the video.

  • File Size

    0.77 Mb

  • Compatible With

    Matlab R19

Share Your Valuable Opinions