二値画像から縦方向,横方向の最大の長さを求めたい
Show older comments
図のような,すこし複雑な縦長の物体の二値画像から縦方向,横方向それぞれの最大の長さを求めたいのですが,良いアイデアが思い浮かびません.
縦方向は最大何ピクセルというように,長さをピクセル数で求めたいです.
わかりにくい文章ですみませんが,どなたか教えていただきたいです.
よろしくお願いします.

Accepted Answer
More Answers (1)
I = imread('image.png');
BW = imbinarize(rgb2gray(I),'adaptive'); % Image Processing Toolboxによる二値化
frts = bwferet(BW,'all') % 最大(最小)フェレ径を求める
imshow(I); hold on % 表示してみる
line(frts.MaxCoordinates{:}(:,1),frts.MaxCoordinates{:}(:,2));
line(frts.MinCoordinates{:}(:,1),frts.MinCoordinates{:}(:,2));
Categories
Find more on コンピューター ビジョンと Simulink in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

