Impact-Site-Verification: dbe48ff9-4514-40fe-8cc0-70131430799e

Search This Blog

COLOR IMAGE SEGMENTATION BASED ON MEAN SHIFT using MATLAB with code

Code:

clc

close all

warning off

rgbImage=imread('peppers.png');

subplot(1,3,1);

imshow(rgbImage);

title('Original Image');

ax=gca;

ax.TitleFontSizeMultiplier=2;

redChannel=rgbImage(:, :, 1);

greenChannel=rgbImage(:, :, 2);

blueChannel=rgbImage(:, :, 3);

data=double([redChannel(:), greenChannel(:), blueChannel(:)]);

[n,m,not_required] = MeanShiftCluster(data',60,0);

n=n';

m=reshape(m',size(rgbImage,1),size(rgbImage,2));

n=n/255;

clusteredImage=label2rgb(m,n);

subplot(1,3,2);

imshow(clusteredImage);

title('High Radius');

ax=gca;

ax.TitleFontSizeMultiplier=2;

[n,m,not_required] = MeanShiftCluster(data',10,0);

n=n';

m=reshape(m',size(rgbImage,1),size(rgbImage,2));

n=n/255;

clusteredImage=label2rgb(m,n);

subplot(1,3,3);

imshow(clusteredImage);

title('Small Radius');

ax=gca;

ax.TitleFontSizeMultiplier=2;

 



Join us on Telegram: https://t.me/matlabcastor

No comments

Popular Posts

Followers