开发者

Why I cannot control intensity of color's components in imshow?

I have the following code:

red = [1 255 0; 0 0 0; 0 0 0];
green = [0 0 0; 0 0 0; 0 0 0];
blue = [0 0 0; 0 0 0; 0 0 0];
figure,imshow(cat(3,red,green,blue))
开发者_运维问答

According to my "intuitive" understanding the color of the first pixel of the image should have the following rgb components: (1,0,0), while the second pixel should have the following components: (255,0,0) (when I say the "first" and "second" I mean the text order: from left to right, from top to bottom).

In other words the first pixel should be almost absolutely black while the second one should be red. However, the both pixels look perfectly red. What am I missing here?


I'm no expert, but I think it's because you're passing doubles to imshow. You could try

imshow(uint8(cat(3, red, green, blue)))
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜