필터 지우기
필터 지우기

Help In Separation of objects in an image into different images

조회 수: 2 (최근 30일)
verbose193
verbose193 2019년 11월 30일
답변: Satadru Mukherjee 2020년 7월 16일
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
The resultant images should contain individual rice as below:
  댓글 수: 1
KALYAN ACHARJYA
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
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

Community Treasure Hunt

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

Start Hunting!

Translated by