How do I circle the pores in a fingerprint image?

조회 수: 1 (최근 30일)
researcher
researcher 2015년 3월 19일
댓글: researcher 2015년 4월 17일
I have extracted pores(the white blobs) in a fingerprint, how do I highlight them by encircling?

채택된 답변

Image Analyst
Image Analyst 2015년 4월 10일
Use bwareaopen() to remove larger blobs. Then use regionprops on the remaining small blobs
binaryImage = binaryImage = bwareaopen(binaryImage, 100);
labeledImage = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'Area', 'Centroid');
allAreas = [measurements.Area];
  댓글 수: 13
Image Analyst
Image Analyst 2015년 4월 16일
What is the minimum blob size that you consider to be not noise? 2 pixels? 5 pixels?
researcher
researcher 2015년 4월 16일
The blob size lies between 2-45 pixels.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2015년 4월 16일
I wish people would stop using im2bw() and graythresh(). They're almost never any good. See the attached code that does pretty much what I said except that there is now the 2-45 size filter in there.
clc;
close all;
workspace; % Make sure the workspace panel with all the variables is showing.
format long g;
format compact;
fontSize = 18;
% Check that user has the Image Processing Toolbox installed.
hasIPT = license('test', 'image_toolbox');
if ~hasIPT
% User does not have the toolbox installed.
message = sprintf('Sorry, but you do not seem to have the Image Processing Toolbox.\nDo you want to try to continue anyway?');
reply = questdlg(message, 'Toolbox missing', 'Yes', 'No', 'Yes');
if strcmpi(reply, 'No')
% User said No, so exit.
return;
end
end
%===============================================================================
% Read in a demo image.
folder = pwd;
baseFileName = 'originalImage.jpg';
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
if ~exist(fullFileName, 'file')
% Didn't find it there. Check the search path for it.
fullFileName = baseFileName; % No path this time.
if ~exist(fullFileName, 'file')
% Still didn't find it. Alert user.
errorMessage = sprintf('Error: %s does not exist.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
grayImage = imread(fullFileName);
% Get the dimensions of the image. numberOfColorBands should be = 3.
[rows, columns, numberOfColorBands] = size(grayImage);
if numberOfColorBands > 1
grayImage = grayImage(:,:,2); % Take green channel if it's color)
end
% Display the original color image.
subplot(2, 2, 1);
imshow(grayImage);
axis on;
title('Original Gray Scale Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'Units', 'Normalized', 'Outerposition', [0, 0, 1, 1]);
% Let's compute and display the histogram.
[pixelCount, grayLevels] = imhist(grayImage);
subplot(2, 2, 2);
bar(grayLevels, pixelCount);
grid on;
title('Histogram of original image', 'FontSize', fontSize);
xlim([0 grayLevels(end)]); % Scale x axis manually.
% Make smaller to speed up the demo
grayImage = imresize(grayImage, 0.25);
% Threshold the image to create a binary image
% binaryImage = im2bw(grayImage); % No good
binaryImage = grayImage > 20; % Better!
% Get rid of blobs smaller than 2 pixels.
binaryImage = bwareaopen(binaryImage, 2);
% Find blobs bigger than 45 pixels.
bigBlobs = bwareaopen(binaryImage, 45);
% Subtract to get blobs in the range 2-45 pixels.
binaryImage = xor(binaryImage, bigBlobs);
% Display the binary image.
subplot(2, 2, 3);
imshow(binaryImage, []);
axis on;
title('Binary Image', 'FontSize', fontSize);
[labeledImage, numberOfBlobs] = bwlabel(binaryImage);
measurements = regionprops(labeledImage, 'Area', 'Centroid');
allAreas = [measurements.Area];
subplot(2, 2, 4);
imshow(grayImage, []);
title('Binary Image with small lines removed', 'FontSize', fontSize);
circleRadius = 5;
hold on;
for k = 1 : numberOfBlobs
blobCentroid = measurements(k).Centroid;
pos = [blobCentroid - circleRadius/2, circleRadius, circleRadius]
rectangle('Position', pos,...
'EdgeColor', 'r', 'Curvature',[1 1])
end
caption = sprintf('%d Pores Detected', numberOfBlobs);
title(caption, 'FontSize', fontSize);

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by