how to extract unique pixels from on image?

Illustration
voxey - 2021-08-10T10:07:51+00:00
Question: how to extract unique pixels from on image?

how to extract unique pixels from on image? can any one share algorithm?  

Expert Answer

Profile picture of John Michell John Michell answered . 2025-11-20

>> I = randi(7,5,4,3) % MxNx3 image array.
I(:,:,1) =
   3   2   5   5
   7   3   6   3
   6   7   6   4
   5   6   4   5
   1   1   1   6
I(:,:,2) =
   7   2   5   2
   7   4   5   7
   2   2   1   4
   3   7   7   2
   6   3   7   7
I(:,:,3) =
   1   2   2   1
   7   2   6   1
   5   6   4   7
   7   6   5   7
   4   6   3   3
>> U = unique(reshape(permute(I,[3,2,1]),3,[]).','rows') % unique pixels (each row = 1 pixel rgb)
U =
   1   3   6
   1   6   4
   1   7   3
   2   2   2
   3   4   2
   3   7   1
   4   4   7
   4   7   5
   5   2   1
   5   2   7
   5   3   7
   5   5   2
   6   1   4
   6   2   5
   6   5   6
   6   7   3
   6   7   6
   7   2   6
   7   7   7


Not satisfied with the answer ?? ASK NOW

Get a Free Consultation or a Sample Assignment Review!