Extracting eyes in shape of circular blobs in binary image

1 view (last 30 days)
Hi
I'm working on face detection in a binary image. After thresholding and morphological operations I'm able to obtain the following figure where the eyes are usually able to be seen as roughly circular blobs.
I've tried extracting them based on their perimeter and area but this range always keeps changing for images under different illumination.I also looked into seperating out the points based on their centroids but I've had no luck there...
Does anyone have any ideas on how I can extract these particular features?
Thank you in advance!

Answers (2)

Image Analyst
Image Analyst on 8 Apr 2012
The Computer Vision Toolbox ( http://www.mathworks.com/products/computer-vision/description4.html) has face recognition (using the widely used Viola Jones method that uses Haar filters ( http://en.wikipedia.org/wiki/Viola%E2%80%93Jones_object_detection_framework)). Can you buy that toolbox? Or are you stuck with your method, which looks like it's some kind of edge detector? If you're required to use your method, then I'd try to find circular objects (and hope they're not things like toys, buttons, etc.) and look for circular shapes by filtering on the ration Perimeter^2/(4*pi*Area) which is 1 for circles and gets bigger for non-circular shapes.
  2 Comments
mayfair
mayfair on 8 Apr 2012
unfortunately, I have to stick with my method I didnt do any edge detection yet I basically mean filtered the image and did a series of binary openings and dialtions and passing through strel elements to get my image..
you're right about the buttons and toys though I was worried about that too for now Im looking into detecting the eyes I'll see what I can do later...
could you please tell me more about filtering using that formula? I've seen you use it on the forum before Do i basically calculate the perimeter & area and pass it into the formula and use ismember or find?
Image Analyst
Image Analyst on 8 Apr 2012
See my Image Segmentation Tutorial: http://www.mathworks.com/matlabcentral/fileexchange/?term=authorid%3A31862
Basically you get the measurements from regionprops and do something like
% Label each blob so we can make measurements of it
labeledImage = bwlabel(binaryImage, 8);
% Get all the blob properties.
blobMeasurements = regionprops(labeledImage, 'all');
allPerimeters = [blobMeasurements .Perimeter];
allAreas = [blobMeasurements .Areas];
circularities = (allPerimeters .^ 2) ./ (4*pi*allAreas);
% Get a list of the blobs that meet our criteria and we need to keep.
allowableIndexes = circularities < 5; % Take the round objects.
keeperIndexes = find(allowableIndexes);
% Extract only those blobs that meet our criteria, and
% eliminate those blobs that don't meet our criteria.
% Note how we use ismember() to do this.
keeperBlobsImage = ismember(labeledImage, keeperIndexes);
% Do everything again for just the round blobs.
% Relabel it with only the round blobs.
binaryImage = keeperBlobsImage > 0;
% Label each blob so we can make measurements of it
labeledImage = bwlabel(binaryImage, 8);
% Re-measure only the round blob properties.
blobMeasurements = regionprops(labeledImage, 'all');
If you want to you could avoid the last remeasurement steps and just extract the values you want from the first set of measurements, but remeasuring shouldn't take too long and it might be an easier concept for you to understand.

Sign in to comment.


mayfair
mayfair on 8 Apr 2012
greatt thank youuuu for helping out i'm going to try this now! I love your BlobsDemo I've learned a lot of neat tricks in Matlab through that:)

Community Treasure Hunt

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

Start Hunting!