How to connect two white dots in binary image ?

I need help, how to connect two white dots in binary image ?. For example the image like this

 採用された回答

KSSV
KSSV 2017 年 5 月 17 日
編集済み: KSSV 2017 年 5 月 17 日

0 投票

I = imread('figure.jpg') ;
I = rgb2gray(I) ;
%%remove the white margin around figure
I = I(50:500,100:900) ;
[y,x] = find(I==255) ;
%%use kmeans clustering
[idx,C] = kmeans([x,y],8); % 8 because there are 8 white patches
imshow(I) ;
hold on
plot(C(:,1),C(:,2),'.b')
plot(C(:,1),C(:,2),'r')

2 件のコメント

Gery Dias Claudio
Gery Dias Claudio 2017 年 5 月 17 日
編集済み: Gery Dias Claudio 2017 年 5 月 17 日
thank you for your answer @KSSV. But i have a new problem, the white dots connected like this picture. Can you help me ?
KSSV
KSSV 2017 年 5 月 17 日
You have the coordinates of centres C of white dot's in your hand..you can join them in the way you want.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeImages についてさらに検索

質問済み:

2017 年 5 月 17 日

コメント済み:

2017 年 5 月 17 日

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by