Clear Filters
Clear Filters

Eye status using histogram

3 views (last 30 days)
Dalal Alhabsi
Dalal Alhabsi on 20 May 2016
Commented: Image Analyst on 10 Jun 2021
Hello i'm doing a project for fatigue detection in real time the problem that i get is with eye status, i want to use histogram to compare between open eye and close eye and then find the difference between them so i can detect eye blink,i found a code that is very helpful, the problem is i want to save a reference image which is (open eye) from the camera , and then compare it with other frames , how can i do that? i want the reference image saved from real time stored in other location so it can't overwrite with other image.
please help
  1 Comment
Dalal Alhabsi
Dalal Alhabsi on 20 May 2016
Im1 = imread('Eeye1.jpg'); Im2 = imread('Eeye.jpg');
Im1 = rgb2gray(Im1); Im2 = rgb2gray(Im2);
% convert images to type double (range from from 0 to 1 instead of from 0 to 255) Im1 = im2double(Im1); Im2 = im2double(Im2);
% Calculate the Normalized Histogram of Image 1 and Image 2 hn1 = imhist(Im1)./numel(Im1); hn2 = imhist(Im2)./numel(Im2);
% Calculate the histogram error f = sum((hn1 - hn2).^2); f; %display the result to console subplot(3,4,[9 10 11 12]); plot(1:size(hn1,1),mean(hn1,2),'b'); hold on plot(1:size(hn2,1),mean(hn2,2),'r');
this is the code i use it for histogram

Sign in to comment.

Answers (3)

Image Analyst
Image Analyst on 20 May 2016
When the driving first starts, take the histogram average over many frames - like for a minute or so. The idea being that when they first start driving, their eyes will be open most of the time. Then after a certain number of frames, save out that average histogram.
Or just read how other people have successfully done it here: http://www.visionbib.com/bibliography/motion-f725.html#Driver%20Monitoring,%20Eyes,%20Gaze
  2 Comments
Dalal Alhabsi
Dalal Alhabsi on 20 May 2016
but how can i convert that to image? like the code?
Image Analyst
Image Analyst on 20 May 2016
You can use MATLAB to write it yourself. Or you can contact the authors and ask if you can buy their code.

Sign in to comment.


asd
asd on 22 Nov 2016
If you looking for the simplest method for the real time detection of the eye blinking which can be simply implemented. you find it in the blog (Designing a simple eye-blink detection algorithm for EEG). I hope this is what you want.
  3 Comments
Vaishnavi M Pastay
Vaishnavi M Pastay on 10 Jun 2021
I am doing the project on Drowsiness Driver Detection using MatLab code. Here is the program for completely Eye opened and closed coding. Please can anyone help me for opened,closed, half closed and or about to close the eyes.
Image Analyst
Image Analyst on 10 Jun 2021
@Vaishnavi M Pastay, you said "Here is the program for completely Eye opened and closed coding." but you forgot to attach it or say where someone could get it. Are you talking about your own code, or the web site @asd mentioned but forgot to include (though I managed to find it and put the link for it in my comment above)?

Sign in to comment.


Vaishnavi M Pastay
Vaishnavi M Pastay on 10 Jun 2021
And it also detect wearing a spectacule.

Community Treasure Hunt

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

Start Hunting!