Each pixel in an image has an rgb value that looks like [r g b], where r,g,b are integer values from 0 to 255.
Now, let us define 8 rgb color extremes:
[0 0 0] black
[0 0 255] blue
[0 255 0] green
[0 255 255] cyan
[255 0 0] red
[255 0 255] magenta
[255 255 0] yellow
[255 255 255] white.
Is there an efficient way in Matlab or a function in Matlab that can convert an image into another image that has these 8 extreme colors, with threshold?