% Machine Learning
%%
clc
clear all
% Adjustable Parameters
k=3;
threshold = .68;
%%
%Load image2 image
I = double(imread('3.jpg'));
[row, col, x] = size(I);
input =reshape(I,row*col,3);
%%
% Fuzzy C Means
[center,U] = fcm(input,k);
% Finding the pixels for each class
maxU = max(U);
index1 = find(U(1,:) == maxU);
index2 = find(U(2,:) == maxU);
index3 = find(U(3,:) == maxU);
%%
% Assigning pixel to each class
input(1:length(input))=0;
input(index1)= 0.5;
input(index2)= 0.3;
input(index3)= 0.1;
[nRows, nCols ]=size(U);
%%
% ITERATE THROUGH U
renew=input;
for u = 1:k
for m = 1:nCols
if U(u,m)< threshold
input(m,:)=0;
end
end
%Reshape input and display each result
input = reshape(input,row,col,3);
figure;imshow(input,[]);impixelinfo;
input=renew;
end
This is the code , but I wanna find mean for the first cluter but I'm not able to find it please help me

답변 (0개)

카테고리

도움말 센터File Exchange에서 Genomics and Next Generation Sequencing에 대해 자세히 알아보기

태그

질문:

2021년 11월 30일

편집:

2021년 11월 30일

Community Treasure Hunt

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

Start Hunting!

Translated by