how to compare the value of a pixel with all other pixel?

5 views (last 30 days)
i have to compare each pixel with all other pixels and find equal values.

Accepted Answer

Andrei Bobrov
Andrei Bobrov on 28 Oct 2013
M = randi(10,40,30);
uM = unique(M);
out = [uM, histc(M(:),uM)];
  3 Comments

Sign in to comment.

More Answers (2)

Jos (10584)
Jos (10584) on 28 Oct 2013
You question is a little unclear. But, see
help unique
M = ceil(10*rand(40,30)) % pixel image
uM = unique(M) ;
% and use it like this
tf = M==uM(k)
[r,c] = find(tf)
  1 Comment
sheno39
sheno39 on 28 Oct 2013
sir i have to compare each pixel with all other pixels and if any pixels having equal values i have to increament the count.

Sign in to comment.


sheno39
sheno39 on 28 Oct 2013
i have attached my image here

Tags

Community Treasure Hunt

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

Start Hunting!