Question: I need to create a function which replicates what imsegkmean s is doing right in this code. Could someone please explain with code. img =

I need to create a function which replicates whatimsegkmeansis doing right in this code. Could someone please explain with code.

img = imread('peppers.png');

T= rgb2lab(img);

T = im2uint8(T);

nrows = size(T,1);

ncols = size(T,2);

[X,Y] = meshgrid(1:ncols,1:nrows);

I = cat(3,T,X,Y);

K = 6;

P = imsegkmeans(T,K);

Z = labeloverlay(T,P);

L = imsegkmeans(I,K);

J = labeloverlay(T,L);

imshowpair(Z,J,'Montage');

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!