how to extract unique pixels from on image?

V
voxey · Aug 10, 2021 · 2K views
Question
how to extract unique pixels from on image? can any one share algorithm?  
Expert Answer
Profile picture of John Michell
John Michell PhD Expert
Answered Aug 20, 2026
>> 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
100% Run Guarantee 3-Hour Fast-Track Delivery

Need a Custom Version or Complete Simulation for This Problem?

Our 500+ PhD engineers build, debug, and optimize working MATLAB scripts and Simulink (.slx) models tailored to your exact assignment rubrics with zero plagiarism.

Tested on MATLAB R2024b / R2026a
Turnitin 0% Plagiarism Report
Free 7-Day Revisions Guarantee
Have a different question? Ask here

Get a Free Consultation or a Sample Assignment Review!