Can anyone help me to segment the stone from the kidney image
조회 수: 3 (최근 30일)
이전 댓글 표시
Hi
I am using k means clustering algorithm and this is code i have used
grayLevels = double(grayImage(:));
[clusterIndexes, clusterCenters] = kmeans(grayLevels, numberOfClusters,...
'distance', 'sqEuclidean', ...
'Replicates', 2);
labeledImage = reshape(clusterIndexes, rows, columns);
subplot(2, 2, 2);
figure,imshow(labeledImage,[]);
caption = sprintf('k-means with %d clusters', numberOfClusters);
title(caption,'FontSize', fontSize);
axis on image;
colorbar
hp = impixelinfo();
And the input and output image are attached here. Can anyone help me to segment the stone region(the white dot) from the image.
Any help is aapreciated.
댓글 수: 0
답변 (1개)
Saurabh Gund
2022년 4월 27일
clc
clear all
close all
warning off
[filename,pathname]=uigetfile('*.*','Pick a MATLAB code file');
filename=strcat(pathname,filename);
a=imread(filename);
%subplot(3,4,1),
imshow(a);
%Convert to grayscale image
%b=rgb2gray(a);
b=im2gray(a);
%subplot(3,4,2),
imshow(b);
impixelinfo;
c=imbinarize(b,20/255);
%c=b>50;
%subplot(3,4,3),
imshow(c);
%Fill the holes in the image
d=imfill(c,'holes');
%subplot(3,4,4),
imshow(d);
%delete writings
e=bwareaopen(d,1000);
%subplot(3,4,5),
imshow(e);
PreprocessedImage=uint8(double(a).*repmat(e,[1 1 3]));
%subplot(3,4,6),
imshow(PreprocessedImage);
댓글 수: 1
Image Analyst
2022년 4월 28일
Here is what your code produces. Where is the kidney?
clc
clear all
close all
warning off
% [filename,pathname]=uigetfile('*.*','Pick a MATLAB code file');
filename = '\st1.png';
pathname = pwd;
filename=strcat(pathname,filename);
a=imread(filename);
%subplot(3,4,1),
imshow(a);
%Convert to grayscale image
%b=rgb2gray(a);
b=im2gray(a);
%subplot(3,4,2),
imshow(b);
impixelinfo;
c=imbinarize(b,20/255);
%c=b>50;
%subplot(3,4,3),
imshow(c);
%Fill the holes in the image
d=imfill(c,'holes');
%subplot(3,4,4),
imshow(d);
%delete writings
e=bwareaopen(d,1000);
%subplot(3,4,5),
imshow(e);
PreprocessedImage=uint8(double(a).*repmat(e,[1 1 3]));
%subplot(3,4,6),
imshow(PreprocessedImage);
참고 항목
카테고리
Help Center 및 File Exchange에서 Computer Vision with Simulink에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!