Clear Filters
Clear Filters

I want to find centroids of image regions: Mean shift

1 view (last 30 days)
% an implementation by "Naotoshi Seo" with a little modification is used
% it is sensitive in choosing parameters.
% an implementation by "Bryan Feldman" is used for “mean-shift clustering"
% Alireza Asvadi
% Department of ECE, SPR Lab
% Babol (Noshirvani) University of Technology
% http://www.a-asvadi.ir
% 2013
%%clear command windows
clc
clear all
close all
%%input
tic;
I=imread('DSC_1540tamp1.jpg');
% I = imread('d1.jpg'); % Original: also test 2.jpg
% I = imread('bb.jpg'); % Original: also test 2.jpg
%%parameters
% kmeans parameter
K = 8; % Cluster Numbers
% meanshift parameter
bw = 0.2; % Mean Shift Bandwidth
% ncut parameters
%%compare
[Ims2, Nms2] = Ms2(I,bw); % Mean Shift (color + spatial)
%%show
figure()
imshow(I); title('Original'),figure;
imshow(Ims2); title(['MeanShift+Spatial',' : ',num2str(Nms2)]);
toc;

Answers (0)

Community Treasure Hunt

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

Start Hunting!