For each pixel, how can you calculate the frequency of its assignment to each cluster using v.

2 Ansichten (letzte 30 Tage)
Verry new to this, trying to find the frequency and create a scatterplot of the data I have with Kmeans cluster.
This is the code I have so far, any help?
clc
k = input('Enter the Number of Clusters you would like to create: ');
X = imread('face2.jpg');
[height, width, dimensions] = size(J);
points = reshape(im2double(X), height * width, dimensions);
totalnumofexec = 5;
M = zeros(height,width,totalnumofexec);
for i=3:totalnumofexec
locations = randperm(size(points,1),k);
C = points(locations,:);
idx = kmeans(points,k,Start=C);
M(:,:,i) = reshape(idx,height,width);
figure, imagesc(M(:,:,i));
end
figure;
plot(M(:,:,i));
title '2D Graph';3
T = groupcounts(M)

Antworten (1)

Image Analyst
Image Analyst am 30 Jan. 2023
Bearbeitet: Image Analyst am 30 Jan. 2023

Community Treasure Hunt

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

Start Hunting!

Translated by