Help In Separation of objects in an image into different images
1 回表示 (過去 30 日間)
古いコメントを表示
Hi,
I have an image of multiple rice grains in jpg format. I need to separate the individual rice grains into a separate images. Need the code for this. Kindly help. The image is as below
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/251561/image.jpeg)
The resultant images should contain individual rice as below:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/251562/image.jpeg)
1 件のコメント
KALYAN ACHARJYA
2019 年 11 月 30 日
編集済み: KALYAN ACHARJYA
2019 年 11 月 30 日
Is the segmented images must be equal size or resutant images can be any sizes?
回答 (1 件)
Satadru Mukherjee
2020 年 7 月 16 日
Check this code:
clc
clear all
close all
x=imbinarize(rgb2gray(imread('Capture.JPG')));
imshow(x);
[L n]=bwlabel(x);
for i=1:n
[r c]=find(L==i);
rmin=min(r);
rmax=max(r);
cmin=min(c);
cmax=max(c);
output=x(rmin:rmax,cmin:cmax);
figure;imshow(output);
end
0 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!