how to select roi???

8 views (last 30 days)
pooja dixit
pooja dixit on 23 Nov 2012
matlab code for how to select region of interest manualy???and extract minutia in that selected region...
  2 Comments
pooja dixit
pooja dixit on 25 Nov 2012
rectangle box.... minutiae:-minutiae are specific points in a finger image. There are two main types, known as ridge endings and bifurcations.

Sign in to comment.

Accepted Answer

Image Analyst
Image Analyst on 25 Nov 2012
Edited: Image Analyst on 26 Nov 2012
How about imrect, or rbbox? Here's a demo for you:
function test1()
clc; % Clear command window.
clear; % Delete all variables.
close all; % Close all figure windows except those created by imtool.
imtool close all; % Close all figure windows created by imtool.
workspace; % Make sure the workspace panel is showing.
fontSize = 16;
% Read in a standard MATLAB gray scale demo image.
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
baseFileName = 'cameraman.tif';
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
% Check if file exists.
if ~exist(fullFileName, 'file')
% File doesn't exist -- 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 in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
grayImage = imread(fullFileName);
% Get the dimensions of the image.
% numberOfColorBands should be = 1.
[rows columns numberOfColorBands] = size(grayImage);
% Display the original gray scale image.
subplot(2, 2, 1);
imshow(grayImage, []);
title('Original Grayscale Image', 'FontSize', fontSize);
% Enlarge figure to full screen.
set(gcf, 'units','normalized','outerposition',[0 0 1 1]);
% Give a name to the title bar.
set(gcf,'name','Demo by ImageAnalyst','numbertitle','off')
% Prompt user to draw a region on the image.
message = sprintf('Draw a box over the image.\nDouble click inside the box to finish drawing.');
uiwait(msgbox(message));
% Erase all previous lines.
ClearLinesFromAxes();
hBox = imrect;
roiPosition = wait(hBox);
roiPosition
% Erase all previous lines.
ClearLinesFromAxes();
xCoords = [roiPosition(1), roiPosition(1)+roiPosition(3), roiPosition(1)+roiPosition(3), roiPosition(1), roiPosition(1)];
yCoords = [roiPosition(2), roiPosition(2), roiPosition(2)+roiPosition(4), roiPosition(2)+roiPosition(4), roiPosition(2)];
% Plot the mask as an outline over the image.
hold on;
plot(xCoords, yCoords, 'linewidth', 2);
% Convert to integer
xCoords = int32(xCoords);
xCoords = int32(xCoords);
% Crop the image
croppedImage = imcrop(grayImage, roiPosition);
subplot(2, 2, 2);
imshow(croppedImage, []);
title('Cropped Grayscale Image', 'FontSize', fontSize);
% Now read in image 2
% Read in a standard MATLAB gray scale demo image.
folder = fullfile(matlabroot, '\toolbox\images\imdemos');
baseFileName = 'moon.tif';
% Get the full filename, with path prepended.
fullFileName = fullfile(folder, baseFileName);
% Check if file exists.
if ~exist(fullFileName, 'file')
% File doesn't exist -- 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 in the search path folders.', fullFileName);
uiwait(warndlg(errorMessage));
return;
end
end
grayImage2 = imread(fullFileName);
% Get the dimensions of the image.
% numberOfColorBands should be = 1.
[rows2 columns2 numberOfColorBands2] = size(grayImage2);
% Make sure roiPosition doesn't go outside the image...
% Display the second gray scale image.
subplot(2, 2, 3);
imshow(grayImage2, []);
title('Second Grayscale Image', 'FontSize', fontSize);
% Crop the second image
croppedImage2 = imcrop(grayImage2, roiPosition);
subplot(2, 2, 4);
imshow(croppedImage2, []);
title('Cropped Second Grayscale Image', 'FontSize', fontSize);
%======================================================================================================================
% Erases all lines from the image axes. The current axes should be set first using the axes()
% command before this function is called, as it works from the current axes, gca.
function ClearLinesFromAxes()
axesHandlesToChildObjects = findobj(gca, 'Type', 'line');
if ~isempty(axesHandlesToChildObjects)
delete(axesHandlesToChildObjects);
end
return; % from ClearLinesFromAxes

More Answers (1)

pooja dixit
pooja dixit on 25 Nov 2012
I have to manually perform the Region of Interest. Using with imrect method..but i want to select two region of interest in two fingerprint image.. means if i select one region of interest in a fingerprint image so this selected region of interest automaticaly select the second fingerprint image. if anyone have any idea of this question plz help me....
  3 Comments
pooja dixit
pooja dixit on 26 Nov 2012
okk i tell you that what i want to do... i am using two fingerprints. and in one fingerprint images if i select an region of interest in one image then using this selected region of interest in second fingerprint image. and then match both the fingerprint image. if minutiae points are same in both fingerprint then matching will be perform else fingerprint are not match. but problem is here that how to use selected region of interest in second image ??
Image Analyst
Image Analyst on 26 Nov 2012
See edited answer above where I put a demo. Just copy, paste, and run.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!