Info
此问题已关闭。 请重新打开它进行编辑或回答。
How to extract and display the white parts of a binary image (attached)
1 次查看(过去 30 天)
显示 更早的评论
I want the algoirthm to display each of the N's (in this case) as a separate figure
0 个评论
回答(1 个)
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
此问题已关闭。
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!