problem to get xy contour coordinates
Show older comments
Hi, I tried to get contour coordinates but it seems that i'm using the wrong solutions, after segementing my image i want to get x y coordinates of the contour here is the image

i tried to use the
C2xyz function then convert it with cell2mat as you can see here
o1=cell2mat ( C2xyz (contour(FC>thresh)))% contour seeds
[ro,wo]=size(o1)
so the size gives 4750 in ro and 1 wo the image size is 128x128 so the coordinates must be in this interval , i've also tried this code
[cx,cy]=(C2xyz(contour(FC >thresh)));
a1 = str2double(cell2mat(a))
xc = str2double(cell2mat(cx))
yc = str2num(cell2mat(cy))
xmin = min(xc);
ymin = min(yc);
B=bwboundaries(a1);
B{1,1}(1,:) = [];
rows = B{1,1}(:,2);
cols = B{1,1}(:,1);
x = (rows-1)*0.5+xmin
y = (cols-1)*0.5+ymin
but it gives NaN values, i will be thankful if someone knows how to extract x y coorinates from the contour i've seen that there is get 'Xdata' is used for fig file , i don't know if generating my plot as fig file then use get ('Xdata') is a solution
thanks in advance,
Answers (0)
Categories
Find more on Contour Plots in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!