mercredi 1 avril 2015

Define 2 plotted lines in an image as variables inside a function in Matlab?


Function [Yupper, Ylower] = Segmentation(A)
A=imread('g16.BMP');
AR=A(:,:,1);
[rows, columns] = size(AR);
avgs = mean(AR(50:165,:), 2);
avgs2 = mean(AR(165:315,:), 2);
[~,ind]= max(abs(diff(avgs)));
[~,ind2]= max(abs(diff(avgs2)));
figure, image(AR,'CDataMapping','scaled'); colormap('gray'); hold on;
Yupper=plot([1 size(AR,2)], [ind+50 ind+50], 'r', 'LineWidth', 2);
Ylower=plot([1 size(AR,2)], [ind2+165 ind2+165], 'g', 'LineWidth', 2);
end


Above is code used to segment grey scale images based on large instensity changes,I'm looking to declare the 2 plotted lines as variables so I can carry out future processing. However, If I type in whos , the lines appear as follows in the table;



YL 1x1 112 matlab.graphics.chart.primitive.Line
YU 1x1 112 matlab.graphics.chart.primitive.Line


if I remove the the plot commands I receive errors associated with brackets etc and if I manipulate the code any further it seems to mess up the correctly plotted data, can anyone help?


Aucun commentaire:

Enregistrer un commentaire