How to group the green contour and the yellow contour?
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I'm using "imcontour" to get the contour of some image. The resulting image is as follow. Is there any way that I can pick out the green contour together as a group, and the yellow contour together as a group?

0 Kommentare
Akzeptierte Antwort
jonas
am 10 Okt. 2018
Bearbeitet: jonas
am 10 Okt. 2018
Sure, the first output of the imcontour, just like any other contour plot, is a contour matrix . If you understand its structure, then it's quite easy to extract the individual levels. If you upload the image and code I might give it a try.
5 Kommentare
jonas
am 12 Okt. 2018
Sure, here is an example. The contours are stored in out and their levels are stored in lvls.
%%Some data
t=1:100;
y=1:100;
z=peaks(100);
%%Get contours
C=contour(t,y,z,'levellist',[2 3]);
cnt=[0];nc=[];idc=[];
while (sum(nc)+cnt)<size(C,2)
cnt=cnt+1;
idc=[idc sum(nc)+cnt];
nc=[nc C(2,idc(end))];
end
%%Save levels and remove the corresponding cols
lvls=C(1,idc);
for j=1:length(idc)-1
out{j} = C(:,idc(j)+1:idc(j+1)-1);
end
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!