BW = im2bw(I, graythresh(I));%二值化
[B,L] = bwboundaries(BW,'noholes');%尋找邊緣,不包括孔
imshow('1.jpg');%原圖
hold on
for k = 1:length(B)
boundary = B{k};
plot(boundary(:,2), boundary(:,1), 'w', 'LineWidth', 2)
end%整個循環表示的是描邊
plot(boundary(:,2), boundary(:,1), 'w', 'LineWidth', 2)
end%整個循環表示的是描邊
function [Xloadings,Yloadings,Xscores,Yscores, ... beta,pctVar,mse,stats] = plsregress(X,Y,ncomp,va