Extracting eyes in shape of circular blobs in binary image
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
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!
0 Commenti
Risposte (2)
Image Analyst
il 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 Commenti
Image Analyst
il 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.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!