Getting black plots with plt.imshow after multiplying an array of images by a scalar

So, I'm a little confused why this is happening.

I have a binary image: enter image description here

Now I want to convert this binary image to RGB space, so I use the function dstackto concatenate the third axis

enter image description here

So far, everything is working fine, but now I have to multiply the array out_imageby 255to reflect the white color in the RGB space, and this is where the problem arises, everything turns blackenter image description here

But if I draw another random image, everything is fine, so what happens here, I also played with cmap, but no matter what type cmapI use, it always turns black when multiplied by255

Any ideas?

+4
1

, 255.
- int8,
out_image = out_image.astype(np.uint8)

, :

. , , .

enter image description here

, 3- RGB- imshow , [0., 1.] [0,255]. ( "3- dtype , unsigned short, float32 float64" ).
:

  • float [0., 1.],
  • [0,255]. , int8, int32.

enter image description here

RGB, [0,1] , [0., 255.].

+5

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


All Articles