Watch this Author's files
This is great code! It's very easy to read and taught me a lot about mean shift.
I found that the runtime was decreased on my machine and data by replacing the lines:
sqDistToAll = sum((repmat(myMean,1,numPts) - dataPts).^2); and beenVisitedFlag(myMembers) = 1;
with:
sqDistToAll = sum(bsxfun(@minus,myMean,dataPts).^2); and beenVisitedFlag(inInds) = 1;
respectively.
Thanks for the code!
Contact us at files@mathworks.com