Segmentation not working properly?

3 Ansichten (letzte 30 Tage)
Warid Islam
Warid Islam am 17 Okt. 2022
Kommentiert: Warid Islam am 21 Okt. 2022
I want to segment tumors from stomach. 'u2.png' is the original image. The region inside the red boundary should be the actual segmentated region. However, my segmentation result is 'u1.png', which is not correct. I tried the method below. Any suggestions would be appreciated, Thank you.
m=imread('u2.png');
T = graythresh(m); % find the threshold for input image
S = imbinarize(m,T); % Segment the image using thresholding
figure, imshow(S,[])
binaryImage = imfill(S, 'holes');
figure, imshow(binaryImage)
BW = bwareafilt(binaryImage, 1);
figure, imshow(BW)
img_class=class(j);
fill=cast(BW,img_class);
m1=fill.*j;
figure,imshow(m1)
  9 Kommentare
Walter Roberson
Walter Roberson am 21 Okt. 2022
j=rgb2gray(imread('IMG-0012-00218.png'));
figure, imshow(j)
[numrow, numcol] = size(j);
[x,y]=getpts;x=round(x);y=round(y);
x = max(3, min(x, numcol-2));
y = max(3, min(y, numrow-2));
a 5 x 5 window centered on x and y should now be entirely within the image, provided that the image has at least 5 rows and 5 columns.
At this point you can do things like
subimage = j(y-2:y+2, x-2:x+2);
do growing within subimage starting from (2,2)
or you can do
maskedimage = zeros(numrow, numcol, 'like', j);
maskedimage(y-2:y+2, x-2:x+2) = j(y-2:y+2, x-2:x+2);
do growing on maskedimage starting from row y column x
Warid Islam
Warid Islam am 21 Okt. 2022
Thank you very much.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Vinayak Choyyan
Vinayak Choyyan am 20 Okt. 2022
Hi,
As per my understanding, you are trying to perform medical image segmentation. I see you are trying to use predefined segmentation techniques but have not got good results.
Please check out this link
to know more about the segmentation tools and methods provided in MATLAB and easily try out various segmentation techniques, including deep learning based segmentation, through MATLAB’s Image Segmenter App. You can also use the Image Segmenter App to refine the segmentation and get better results.
  3 Kommentare
Vinayak Choyyan
Vinayak Choyyan am 21 Okt. 2022
In that case you can train a supervised deep learning model to do automatic segmentation.
You will have to create dataset to train the model for automatic segmentation. To label/segment the training images, you can use the Image Labeler, Video Labeler, or Ground Truth Labeler apps. Then you could train various deep learning models like convolutional neural network (CNN) based encoder decoder segmentations to get a fairly accurate model. You can leverage the tools available in MATLAB, which you can find in the link in my comment above.
Or you could also find many examples of medical image segmentation on google which used deep learning and produced good results of accuracy. It is a highly explored topic.
Warid Islam
Warid Islam am 21 Okt. 2022
Thank you for your suggestions.

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by