Can Some body tell me what the lines that I have but arrows (%<-----------------
ID: 647396 • Letter: C
Question
Can Some body tell me what the lines that I have but arrows (%<------------------) next to to do on this MatLab Code Do. Just add comments next to the lines. This program scans a finger print image and then returns a thinned image. Picture of output below code.
%-----Code Starts Here -------------------------------
%Program for Fingerprint Minutiae Extraction
function [outImg] = MinutiaeExtraction (imG, FigureNum)
%Read Input Image
%binary_image=im2bw(imread('107_7.tif'));
binary_image=im2bw(imG);
%Zoom in on the fingure print so Display to ridges clearly. This mainly
%for demonstration purposes.
binary_image = binary_image(120:400,20:250);
figure(FigureNum), subplot(1,3,1), imshow(binary_image); title('Input image');
%Thinning
%It removes pixels so that an object without holes shrinks to a minimally
%connected stroke, and an object with holes shrinks to a connected ring
%halfway between each hole and the outer boundary
thin_image=~bwmorph(binary_image,'thin',Inf);
figure(FigureNum), subplot(1,3,2), imshow(thin_image), title('Thinned Image');
%----Minutiae extraction-----------------
% Create a new varable equal to the thinned image size.
s=size(thin_image);
N=3;%window size
n=(N-1)/2; %<----------------------
r=s(1)+2*n; %<----------------------
c=s(2)+2*n; %<----------------------
double temp(r,c);
temp=zeros(r,c);bifurcation=zeros(r,c);ridge=zeros(r,c);
temp((n+1):(end-n),(n+1):(end-n))=thin_image(:,:);
%Create an array of zeros
outImg=zeros(r,c,3);%For Display
outImg(:,:,1) = temp .* 255; %<----------------------
outImg(:,:,2) = temp .* 255; %<----------------------
outImg(:,:,3) = temp .* 255; %<----------------------
%We need to find ridges by dividing the padded image named temp into
%block size of 2n+1 i.e. going from x-n to %x+n in rows and y-n to y+n
%in coloumns, this is done by for loop 3 and 4. Also we need to move
%this window %over the entire image, this is achieved by first two for loops.
for x=(n+1+10):(s(1)+n-10) % This variable is used to move the window over temp along the row
for y=(n+1+10):(s(2)+n-10) % This variable is used to move the window over temp along the coloumn
e=1; %<----------------------
for k=x-n:x+n % This variable forms the window over temp centered at x going from x-n to x+n
f=1; %<----------------------
for l=y-n:y+n % This variable forms the window over temp centered at y going from y-n to y+n along the coloums
mat(e,f)=temp(k,l);
f=f+1; %<----------------------
end
e=e+1; %<----------------------
end;
if(mat(2,2)==0) %<----------------------
ridge(x,y)=sum(sum(~mat)); %<----------------------
bifurcation(x,y)=sum(sum(~mat)); %<----------------------
end
end;
end;
% RIDGE END FINDING
[ridge_x ridge_y]=find(ridge==2); %<----------------------
%Returns the lenght of the largest array dimensions back to ridge_X
len=length(ridge_x);
%For Display
for i=1:len
outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)-3),2:3)=0; %<----------------------
outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)+3),2:3)=0; %<----------------------
outImg((ridge_x(i)-3),(ridge_y(i)-3):(ridge_y(i)+3),2:3)=0;
outImg((ridge_x(i)+3),(ridge_y(i)-3):(ridge_y(i)+3),2:3)=0;
outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)-3),1)=255; %<----------------------
outImg((ridge_x(i)-3):(ridge_x(i)+3),(ridge_y(i)+3),1)=255; %<----------------------
outImg((ridge_x(i)-3),(ridge_y(i)-3):(ridge_y(i)+3),1)=255;
outImg((ridge_x(i)+3),(ridge_y(i)-3):(ridge_y(i)+3),1)=255;
end
%BIFURCATION FINDING
[bifurcation_x bifurcation_y]=find(bifurcation==4);
len=length(bifurcation_x);
%For Display
for i=1:len
outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)-3),1:2)=0; %<----------------------
outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)+3),1:2)=0; %<----------------------
outImg((bifurcation_x(i)-3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),1:2)=0;
outImg((bifurcation_x(i)+3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),1:2)=0;
outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)-3),3)=255;
outImg((bifurcation_x(i)-3):(bifurcation_x(i)+3),(bifurcation_y(i)+3),3)=255;
outImg((bifurcation_x(i)-3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),3)=255;
outImg((bifurcation_x(i)+3),(bifurcation_y(i)-3):(bifurcation_y(i)+3),3)=255;
end
figure(FigureNum), subplot(1,3,3), imshow(outImg), title('Minutiae');
%------Code Ends Here------------------------------------
Explanation / Answer
Those are comments
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.