白黒画像における領域の検知方法について
Afficher commentaires plus anciens

上記のような BW という白黒の図から白の領域を検知するために、以下のようなスクリプトを作成したのですが、
%% find bound area
BW = bwselect(BW,1:size(BW,2),ones(1,size(BW,2)),4);
BW = bwselect(BW,1:size(BW,2),ones(1,size(BW,2))*size(BW,1),4);
figure
[B,L,N,A] = bwboundaries(BW);
imshow(BW); hold on;
colors=['g' 'b' 'r' 'y' 'm' 'c'];
for k=1:length(B)
boundary = B{k};
cidx = mod(k,length(colors))+1;
plot(boundary(:,2), boundary(:,1),...
colors(cidx),'LineWidth',2);
rndRow = ceil(length(boundary)/(mod(rand*k,7)+1));
col = boundary(rndRow,2); row = boundary(rndRow,1);
h = text(col+1, row-1, num2str(L(row,col)));
set(h,'Color',colors(cidx),'FontSize',14,'FontWeight','bold');
end
上記の図にある1つ目の白黒画像は無事領域が検知できたのに対し、2つ目の白黒画像は検知できませんでした。
その理由とどうすれば検知できるようになるのか教えていただきたいです。
1 commentaire
Hernia Baby
le 31 Oct 2022
画像添付できますでしょうか?試してみたいです。
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur オブジェクト解析 dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!



