Image Analysis Help for Eye blink detection

42 views (last 30 days)
Vikas
Vikas on 18 Mar 2014
Commented: Shahrokh Firouzi on 28 Sep 2021
I am working on a eye blink detection project. By this moment I have been successfully extracted the images of pupil of eye from the real time video.
But I am stuck at the process to differentiate the open eye pupil to the closed eye lid state.
1. Open eye pupil
2. closed eye lid
Could you please suggest me any image processing function or algorithm to differentiate between the two states.
(Attached images are the original images on which image processing is to be done.)
  2 Comments
ramkumar r
ramkumar r on 27 Jun 2019
Hello VIkas,
Can you share the code of eye detection and pupil ext6raction plz.

Sign in to comment.

Accepted Answer

Dishant Arora
Dishant Arora on 18 Mar 2014
You can have a plot of average horizontal intensities.In case eye is closed the distance between two deep valleys would increase as eyelashes would move far from the brows:
I1 = imread('openEyeImage');
I1 = rgb2gray(I1)
plot(1:size(I1,1) , mean(I1,2));
hold on
I2 = imread('closeEyeImage');
I2 = rgb2gray(I2)
plot(1:size(I2,1) , mean(I2,2) , 'r');
Check out the difference between two plots.
Or you can go from blob detection, find circular objects. Call regionprops check out for ecentricity. This would be useful: Blobs Detection
  7 Comments
Image Analyst
Image Analyst on 22 Jan 2016
I think it's usually called "drowsiness detection". See my Answer for a link to published papers on it.

Sign in to comment.

More Answers (6)

Image Analyst
Image Analyst on 19 Mar 2014
  4 Comments
Image Analyst
Image Analyst on 19 Mar 2014
If you're at a University, the papers will be available for free most likely. If you work for a company they will spend less money to order papers than paying you to flounder for months trying different, unproven approaches.
I did give two approaches (radial profile or mean). Try to program those up.

Sign in to comment.


kishan nagesh
kishan nagesh on 31 Mar 2014
please can anyone send me the code for detecting the pupil of the eye from segmented image of the face . I am currently working on a project for detecting driver fatigue i am not able to get an idea as to how to get to know state of eye ie open or closed after edge detection of face . Please help me out people .

rohith h.c
rohith h.c on 1 Apr 2014
iam doing the project on visual pattern recognition based on color,morphological statistical and textural features i have the algorithm and i need the matlab code since iam new to matlab. please mail the code to rohith.iyengar123@gmail.com 1.take the rgb input image of a fruit 2.convert it to gray scale 3.remove all noises 4.if background is light,make it dark 5.perform background subtraction and image segmentation using otsu's method.
  1 Comment
Image Analyst
Image Analyst on 1 Apr 2014
This has little or nothing to do with eye blink detection. Why don't you start your own thread? Or search for tag:fruit since lots of people here want to do fruit analysis and there are lots of threads on it.

Sign in to comment.


rohith h.c
rohith h.c on 9 Apr 2014
i have a piece of code can anyone explain me the code?
clc clear all close all sand = imread('fruit_256.BMP'); [x,y]=size(sand); I3 = medfilt2(sand,[3 3]); I3 = imadjust(I3); bw1 = im2bw(I3, 0.9); bw = bwareaopen(bw1, 10); bw0= 1 - bw; I2 = bwfill(bw0,'holes'); se=strel('square',3); SI1=imerode(I2,se); se1=strel('square',10); I1=imdilate(SI1,se1); [labeled,numObjects] = bwlabel(I1,4);
RGB_label=label2rgb(labeled,@spring,'c','shuffle'); chrdata = regionprops(labeled,'all') allchrs = [chrdata.Area]; num = size(allchrs); % BW1=edge(labeled,'sobel', 0.11); yuan = [chrdata.Eccentricity]; [line,row]=size(yuan); long = [chrdata.MajorAxisLength]; width = [chrdata.MinorAxisLength]; nbins = 20;
figure(1); imshow(sand);title('Original') figure(2); imshow(I3);title('medfilt') figure(3); imshow(bw);title('0-1') figure(4); imshow(I2);title('bwfill') figure(5); imshow(I1);title('imdilate') figure(6); imshow(RGB_label);title('RGB') figure(7),hist(allchrs,nbins); title(num(2)) figure(8),hist(yuan,nbins); title(num(2))
  1 Comment
Dishant Arora
Dishant Arora on 9 Apr 2014
Create a new thread, it has nothing to do with this.

Sign in to comment.


rohith h.c
rohith h.c on 10 Apr 2014
pls can u explain each line of the below code with comments?
clc clear all close all sand = imread('fruit_256.BMP'); [x,y]=size(sand); I3 = medfilt2(sand,[3 3]); I3 = imadjust(I3); bw1 = im2bw(I3, 0.9); bw = bwareaopen(bw1, 10); bw0= 1 - bw; I2 = bwfill(bw0,'holes'); se=strel('square',3); SI1=imerode(I2,se); se1=strel('square',10); I1=imdilate(SI1,se1); [labeled,numObjects] = bwlabel(I1,4);
RGB_label=label2rgb(labeled,@spring,'c','shuffle'); chrdata = regionprops(labeled,'all') allchrs = [chrdata.Area]; num = size(allchrs); % BW1=edge(labeled,'sobel', 0.11); yuan = [chrdata.Eccentricity]; [line,row]=size(yuan); long = [chrdata.MajorAxisLength]; width = [chrdata.MinorAxisLength]; nbins = 20;
figure(1); imshow(sand);title('Original') figure(2); imshow(I3);title('medfilt') figure(3); imshow(bw);title('0-1') figure(4); imshow(I2);title('bwfill') figure(5); imshow(I1);title('imdilate') figure(6); imshow(RGB_label);title('RGB') figure(7),hist(allchrs,nbins); title(num(2)) figure(8),hist(yuan,nbins); title(num(2))
  1 Comment
Image Analyst
Image Analyst on 10 Apr 2014
No. Read the responses to the prior two times you asked the same thing.

Sign in to comment.


Waheed Ullah
Waheed Ullah on 17 Apr 2015
After reading an image (jpeg, png, etc.), then I want to detect eyes and find the distance between human eyes. So if anyone have such a code then please inbox me (<mailto:waheedullah356@gmail.com waheedullah356@gmail.com>) or give here. Thanks.
  1 Comment
Shahrokh Firouzi
Shahrokh Firouzi on 28 Sep 2021
There is a thing which call creativity. I think instead of asking codes from others, use the sample codes above and find your way. For sure there are difficulties to find out the others' coding but in that moment you figure out the way of writing codes, you can do whatever that you want.

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!