From: Ryan on 10 Apr 2010 20:53 Hi there, I have been trying to write a simple conceptual code for eye tracking. It is as attached. I am trying to detect whether the eyes are open or closed, whereby if they are open they are continuously tracked and if they are closed they sound an alarm of some sort. To detect the closure of eyes I was wondering how to detect that the entire returned image is all black, which implies the eyes are closed. At the moment if the morphological operations cannot be done then the centroids cannot be plotted and therefore returns an error. How can I get it to detect if there are no eyes, ie. detect all pixels are black? Then return some sort of notification which ideally is audio. The "irtest_new.m" file shows a single image (where I had one image of my eyes open and then one with my eyes closed) concept of what i am trying to achieve and the "imaq_frames_demo1.m" file is a frame based solution. Any help would be much appreciated. Many thanks __________________________________________________________________ "irtest_new.m" tic; i = imread('ir_test_closed.png'); figure, imshow(i); I = i(:,:,2); figure, imshow(I); I_bw = ~im2bw(I,65/255); figure, imshow(I_bw); se = strel('disk',5); I_erode = imerode(I_bw,se); figure, imshow(I_erode); I_dilate = imdilate(I_erode,se); figure, imshow(I_dilate); L = bwlabel(I_dilate,8); s = regionprops(L, 'centroid', 'Area'); %returns a structure, containing centroids centroids = cat(1, s.Centroid); figure, imshow(I_dilate) hold on plot(centroids(:,1), centroids(:,2), 'b*') hold off toc; ________________________________________________________________ "imaq_frames_demo1.m" tic; vid = videoinput('winvideo'); set(vid, 'ReturnedColorspace', 'RGB'); for i = 1:3 snapshot = getsnapshot(vid); figure, imshow(snapshot); I = snapshot(:,:,2); figure, imshow(I); I_bw = ~im2bw(snapshot,65/255); % If there are no white pixels then return sound as though eyes are % closed. se = strel('disk',5); I_erode = imerode(I_bw,se); I_dilate = imdilate(I_erode,se); L = bwlabel(I_dilate,8); s = regionprops(L, 'centroid', 'Area'); %returns a structure, containing centroids centroids = cat(1, s.Centroid); figure, imshow(I_dilate) hold on plot(centroids(:,1), centroids(:,2), 'b*') hold off end toc; __________________________________________________________________
From: ImageAnalyst on 10 Apr 2010 23:44 How is anybody supposed to do anything with this when you have not provided "ir_test_closed.png'"? You'll need to post it if you want anybody to try your code. You can post it to http://drop.io Post the open eyes image too.
From: Ryan on 11 Apr 2010 07:07 ImageAnalyst <imageanalyst(a)mailinator.com> wrote in message <a884497a-daab-4907-8f34-ee7403f02961(a)b23g2000yqn.googlegroups.com>... > How is anybody supposed to do anything with this when you have not > provided "ir_test_closed.png'"? > You'll need to post it if you want anybody to try your code. > You can post it to http://drop.io > Post the open eyes image too. All files available at: http://drop.io/bigbassistmatlab Thanks
|
Pages: 1 Prev: TooltipString Value Next: Fitting a geometric distribution |