The mllab rgb value dilemma

When I wrote these commands

out = ones(size(ben))
imshow(out)

the output is a white image, but I expect an almost dark image because the rgb values ​​are 1,1,1. when I give 255255,255, it also gives a white image. Isn't that a dilemma?

+3
source share
1 answer

Try out = ones(size(ben), 'uint8');

ones()creates a doubling array by default. When it imshow()receives an array of doubles, it assumes that the pixel values ​​are in the range from 0 to 1, and assigns a white color to something greater than 1. However, if you pass the array from uint8to imshow(), it will count the range from 0 to 255.

imagesc(); imshow(), colormap gray , , .

:

imshow(out / max(out(:)));
+3

Source: https://habr.com/ru/post/1781345/


All Articles