What does the index refer to when selecting a pixel on an image in Matlab?

こ雲淡風輕ζ 提交于 2019-12-02 02:42:21
rayryeng

If you want to talk about "index", we need to go into what are known as indexed images. Take for example the mandrill data set that you can load into MATLAB via:

>> load mandrill 

You see that there is a colour map called map and an indexed image called X. The colour map is a N x 3 matrix where each row gives you a unique RGB tuple that describes a particular colour. The first column is the proportion of red, the next column is the proportion of green and the last column is the proportion of blue that describes the colour in that row. All colours are between [0,1] which make sense as we're describing proportions.

When we take a look at indexed images, each location in this image gives you the location in the colour map that you would need to sample from in order to represent what colour this pixel is at this point. A great pictorial representation can be shown here:

Source: MathWorks

As you can see, the indexed image gives you the right row you need to sample from in the colour map so that you can fill in the corresponding location with the right colour. As such, for the circled pixel in the indexed image, the index is 5, which means that we need to get the fifth row of the colour map and that's the colour that we would need to paint onto the screen.


For the case of grayscale images, the index is simply the intensity. If you want to look at it blindly, the index is simply the value seen at the image itself, whether it be an indexed image or a grayscale image. However, depending on the context, the index means to either sample from a colour map, or just look at the intensity of the image itself.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!