Not getting correct vein pattern from image after mophological operation
Mostra commenti meno recenti
Sir, in attached image is output of some morphological operation but still some unwanted region is present how to remove this.
clc; close all; %% myFolder = 'E:\MATLAB\R2016b\bin\img\PCA\my_PhD_Programs\Jermanfilter\db\Train'; roiFolder = 'E:\MATLAB\R2016b\bin\img\PCA\my_PhD_Programs\Jermanfilter\dbROI'; filePattern = fullfile(myFolder, '*.bmp'); dataFiles = dir(filePattern);
for k=1:length(dataFiles), [pathstr,name,ext] = fileparts(dataFiles(k).name); fullFileName = fullfile(myFolder,name); currFile = fullfile(myFolder,name); currFile1 = fullfile(roiFolder,name); fname1 = sprintf('%s.bmp',currFile); fname2 = sprintf('%s.bmp',currFile1); I=imread(fname1); %I = imread('201.bmp');
% preprocess the input a little bit Ip = single(I); thr = prctile(Ip(Ip(:)>0),1) * 0.9; Ip(Ip<=thr) = thr; Ip = Ip - min(Ip(:)); Ip = Ip ./ max(Ip(:));
% compute enhancement for two different tau values %V1 = vesselness2D(Ip, 0.5:0.5:2.5, [1;1], 1, false); V2 = vesselness2D(Ip, 0.5:0.5:2.5, [1;1], 0.5, false);
subplot(2,2,1);
imshow(V2);
title ('Jerman filter');
skel = bwmorph(V2,'thin',Inf);
subplot(2,2,2);
imshow(skel);
title ('thin');
B = bwmorph(skel, 'branchpoints'); E = bwmorph(skel, 'endpoints');
[y,x] = find(E); B_loc = find(B);
Dmask = false(size(skel)); for k = 1:numel(x) D = bwdistgeodesic(skel,x(k),y(k)); distanceToBranchPt = min(D(B_loc)); Dmask(D < distanceToBranchPt) =true; end skelD = skel - Dmask;
subplot(2,2,3); imshow(skelD);
hold all; [y,x] = find(B); %plot(x,y,'ro')
Risposte (0)
Categorie
Scopri di più su Morphological Operations in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!