i plot more curves in 1 window , want see superposing curves.. concretely plot rho_start 3 curves in 1 window. don´t know how write in code. here it:
clear,clc,close abc='abc'; cal=18/230; results=[]; data=[]; i=1:3 im=imread(['vz_' num2str(j) abc(i) '.jpg']); im=imresize(im,0.5); %figure,imshow(im) i=rgb2gray(im); %figure,imshow(i); j=imadjust(i); %figure,imshow(j); t=graythresh (j); bw=im2bw(j,t); %figure,imshow(bw); bwi=1-bw; %figure,imshow(bwi); b=imclearborder(bwi); o=bwareaopen(b,40000); h=imfill(o,'holes'); l=bwlabel(h); s=regionprops(l,'area','perimeter'); se=[0 1 0;1 1 1;0 1 0]; %figure,imshow(h); d=imdilate(h,se); e=edge(d,'canny'); %imshow(e); bound=bwboundaries(e); %figure,imshow(e);hold on; k=1 b=bound{k}; %plot(b(:,2),b(:,1),'r','linewidth',1.5); end x=1:numel(s) %plot(s(x).centroid(1),s(x).centroid(2),'ro'); end xx=b(:,2); yy=b(:,1); %figure,plot(xx,yy);axis equal; xx=xx-mean(xx); yy=yy-mean(yy); theta=xx; rho=yy; %figure,plot(xx,yy);axis equal; [theta,rho]=cart2pol(xx,yy); %figure,polar(theta,rho); %figure,plot(theta); %figure,plot(rho); rho_smooth=smooth(rho,30); [mc,xc]=min(rho_smooth); *rho_start* =[rho_smooth(xc:size(rho_smooth));rho_smooth(1:xc)]; tc=1:length(rho_start); [~,locsc]=findpeaks(rho_start,'minpeakheight',160,'minpeakdistance',50); figure;hold on; plot(tc,rho_start); plot(locsc,rho_start(locsc),'rv','markerfacecolor','r'); grid on; title('number of peaks'); xlabel('angle'); ylabel('radius'); data=[data; (s.area)*cal^2 (s.perimeter)*cal]; end data as=mean(data(:,2)); results=[results; j as]; end
to plot more things in same axes use hold on
:
figure; hold on; plot(1:10,1:10); plot(1:5,:2:6);
to plot more 1 axes in each plot use subplot
figure; subplot(121) plot(1:10,1:10); subplot(122) hold on plot(1:10,1:10); plot(1:5,:2:6);
Comments
Post a Comment