Info

この質問は閉じられています。 編集または回答するには再度開いてください。

How to extract and display the white parts of a binary image (attached)

1 回表示 (過去 30 日間)
Ananya Panda
Ananya Panda 2018 年 3 月 22 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
I want the algoirthm to display each of the N's (in this case) as a separate figure

回答 (1 件)

KSSV
KSSV 2018 年 3 月 22 日
Crop the image, so thjat there is no white along the backgrounds.
I = imread('untitled.png') ;
I1 = rgb2gray(I) ;
[y,x] = find(I) ;
N = 4 ; % number of N's in the image
idx = kmeans([x y],N) ;
imshow(I)
hold on
data= cell(N,1) ;
for i = 1:N
data{i} = [x(idx==i),y(idx==i)] ;
plot(data{i}(:,1),data{i}(:,2),'.','color',rand(1,3))
end
  2 件のコメント
Ananya Panda
Ananya Panda 2018 年 3 月 22 日
The output of the above code is attached. I want the program to take the input image ( in this case the image with the ns but it doesn't necessarily have to be limited to letters) and then display 5 different images each having one of the different ns
KSSV
KSSV 2018 年 3 月 22 日
You can very much plot each N. You have that in data.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by