Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % Comment: Classify the Colors in 'a*b*' Space Using Fixed K-Means Clustering
- ab = double(rgb_he(:,:,2:3));
- ab_all_band = double(rgb_he(:,:,2:3));
- nrows = size(ab,1);
- ncols = size(ab,2);
- ab = reshape(ab,nrows*ncols,2);
- nColors = 3;
- [cluster_idx, cluster_center] = kmeans(ab,nColors, ...
- 'Replicates',1, ...
- 'Options',opts, ...
- 'start',[118 143; 127 140; 133 127]);
- % Define A*B color on each cluster. (this example have 3 cluster)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement