Ask Your Question

Revision history [back]

Is there a way to easily plot pixels?

Let's say I have a Mat M which contains a grayscale image. Now I apply a colormap to make a new Mat M_color and show the image. The colormap is fine, but at specific points (where I already know the indices), I want to make the pixels a specific color (let's say black).

Example: I have a 25x25 grayscale image shown with a rainbow colormap. At pixels (2,7), (4,12), (16,9), and (14,23) I want them to be black.

Is there an easy way to plot the black pixels over-top the rainbow image? Or if it's easier, to just change the color at that specific instance to black.