Info
This question is closed. Reopen it to edit or answer.
Sir, after applying radon like featur for hand vein enhancement i want to write image in folder but am not getting how to write it, i have tried by imwrite function but output image is not that i want
1 view (last 30 days)
Show older comments
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Radon like feature for hand vein enhancement
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clear all; close all;
myFolder = 'E:\MATLAB\R2016b\bin\img\PCA\my_PhD_Programs\radonlikefeature\dbROIsegment'; roiFolder = 'E:\MATLAB\R2016b\bin\img\PCA\my_PhD_Programs\radonlikefeature\dbROI\ice'; filePattern = fullfile(roiFolder, '*.bmp'); dataFiles = dir(filePattern);
for k=1:length(dataFiles), [pathstr,name,ext] = fileparts(dataFiles(k).name); fullFileName = fullfile(roiFolder,name); currFile = fullfile(roiFolder,name); currFile1 = fullfile(myFolder,name); fname1 = sprintf('%s.bmp',currFile); fname2 = sprintf('%s.bmp',currFile1); imo=imread(fname1);
res = 36; % # of directions of scanning ang = 360/res; % angular resolution of scanning
%scaling the image to 0 - 255 imo = imo - min(imo(:)); imo = imo ./ max(imo(:)) * 255; [imro imco] = size(imo);
%edge enhancing features sf = getEdgeFeatures(imo,5,3,12); %%%%%%% i have changed it from 15 to 5 b my self %% 5 3 12 imo = (max(sf,[],3));
%set the boundary to be 0 imo(1,:) = 0;imo(imro,:)=0;imo(:,1) = 0;imo(:,imco)=0;
%set the knots edo = edge(imo,'canny',0.25); % i alsso change this value from 0.37 to 0.25
dumo = ones(imro,imco); % helper matrix to keep track of ROI
%some variable initialization dum=1;ed=1;int=1; intx = zeros(imro,imco,res,1);
for xx=1:res % repeat for each scan direction fprintf('Scan %d\n',xx);
%rotate the image by the scanning angle
%this allows us to scan always along the horizontal axis
% NOT THE MOST EFFICIENT WAY OF DOING THING
im = imrotate(imo,ang*(xx-1));
dum = imrotate(dumo,ang*(xx-1)); %rotate ROI tracker
ed = imrotate(edo,ang*(xx-1)); %rotate knot function.
%This may change the know function slightly due to
%interpolation artifacts.
[imr imc] = size(im);
int = im .* 0;
flag = 0;
for i=1:imr %for each row in the image
j=1;
while((dum(i,j) == 0) && (j < imc)) %find ROI beginning
j=j+1;
flag = 1;
end
prev = j;
while((dum(i,j) ~= 0) && (j < imc)) %till we get out of ROI
if(ed(i,j) == 1) %We hit a know
if(j-prev < -1)
int(i,prev:j) = 255;
else
%extraction function which assigns mean value
%change this to change the extraction function
int(i,prev:j) = mean(im(i,prev:j));
end
prev = j;
flag = 0;
end
j=j+1;
end
end
int = imrotate(int,-ang*(xx-1)); %rotate the feature image back
[imr imc] = size(int);
osetr = floor((imr-imro)/2);
osetc = floor((imc-imco)/2);
int = int(osetr+1:osetr+imro,osetc+1:osetc+imco); %extract ROI
intx(:,:,xx) = int; %store ROI
end
%show the mean of the computed Radon-Like Features
%subplot(2,3,2);
x= imshow(mean(intx,3),[]); %imshow(im,[]);
%imwrite(mean(intx,3),[],fname2); %imwrite(int,fname2); %figure, imshow(ro); end
0 Comments
Answers (0)
This question is closed.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!