Unable to select seed points manually in region growing algorithm

1 次查看(过去 30 天)
Hi,
I am trying to implement a multilayer region growing algorithm for breast tumor segmentation. I am trying to select the initial seed point manually. I left clicked on the center point on the image once and pressed enter, but it is showing me an error message. Any suggestions would be appreciated.
I= rgb2gray((imread('TM25.jpg')));
figure,imshow(I)
[x,y]=getpts;
% x=300; y=340;
a=imgaussfilt(I,2);
b=adapthisteq(a);
m=regiongrowing_MLT(b,x,y,12);
m=imfill(m,'holes');
figure,imshow(m)
The following error message is displayed.
Index in position 2 is invalid. Array indices must be positive integers or logical values.
Error in regiongrowing_MLT (line 6)
A1 = double(img(x,y));
Error in segm (line 8)
m=regiongrowing_MLT(b,x,y,12);

采纳的回答

Rik
Rik 2021-3-24
编辑:Rik 2021-3-24
getpts will return decimal values, so you will have to use round.
I= rgb2gray((imread('TM25.jpg')));
figure,imshow(I)
[x,y]=getpts;x=round(x);y=round(y);
% x=300; y=340;
a=imgaussfilt(I,2);
b=adapthisteq(a);
m=regiongrowing_MLT(b,x,y,12);
m=imfill(m,'holes');
figure,imshow(m)
Also, you might be interested in RegGrow, which doesn't require any toolbox and produces the same result on a wide range of runtimes (it works GNU Octave, and every release of Matlab of the past 2 decades).

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Image Processing Toolbox 的更多信息

产品


版本

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by