Is there a way to segment this image into 3 parts, even though the colours are so similar?

조회 수: 2 (최근 30일)
Hi folks, I am trying to segment the following image of a seed. The points of interest look very similar in RGB, HSV, LAB and YCbCr colour spaces. Is there a way to segment out the 3 areas of interest? I am looking specifically to segment out the germ, endosperm (corneus + floury) and pericarp. I need to find an automated way to do this as there are hundreds of images to analyse!
Below is an example of my images, followed by a labelled diagram of the seed.
Thanks in advance!

채택된 답변

yanqi liu
yanqi liu 2021년 12월 1일
yes,sir,may be use kmeans or watershed
clc;
clear all;
close all;
img = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/818419/image.png');
img = imresize(img, 0.3, 'bilinear');
im = rgb2gray(img);
bw = ~imbinarize(im,'adaptive','ForegroundPolarity','dark','Sensitivity',0.6);
bw = imclose(imopen(bw, strel('disk', 2)), strel('disk', 5));
bw = bwareafilt(bw,1);
bw = imfill(bw, 'holes');
bw = imopen(bw, strel('disk', 13));
bw = bwareafilt(bw,1);
im = im .* uint8(bw);
% make segment
im = mat2gray(im);
bw1 = imbinarize(im,'adaptive','ForegroundPolarity','dark','Sensitivity',0.7);
bw1 = imclose(bw1, strel('disk', 5));
bw1 = imopen(bw1, strel('disk', 15));
bw1 = imdilate(bwareafilt(bw1,1), strel('disk', 5));
figure; imshow(img);
hold on;
h=imshow(label2rgb(bwlabel(bw1)),[]);
set(h,'AlphaData', 0.6)
  댓글 수: 2
Teshan Rezel
Teshan Rezel 2021년 12월 10일
@yanqi liu thank you for responding, but I'm looking to segment the top image, not the bottom one! The technique you used doesn't appear to work for that one...
yanqi liu
yanqi liu 2021년 12월 11일
yes,sir,is it to segment 3 parts,may be by color or pixel,such as
clc;
clear all;
close all;
img = imread('https://www.mathworks.com/matlabcentral/answers/uploaded_files/818414/image.png');
J = rgb2lab(img);
im = mat2gray(J(:,:,1));
mk = im2bw(im,0.9);
mk = ~mk;
mk = imfill(mk, 'holes');
mk = bwareafilt(mk,1);
im(~mk) = 0;
thresh = multithresh(im,3);
seg_im = imquantize(im,thresh);
figure; imshow(img);
hold on;
h=imshow(label2rgb(seg_im),[]);
set(h,'AlphaData', 0.6)

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Segmentation and Analysis에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by