The matplotlib visualization image is clearly 255, but the result is all black.

created at 11-22-2021 views: 3


When matplotlib is in imshow, if it receives a two-dimensional matrix, it will automatically normalize it and map it to color. If the values in the input matrix are all the same, normalization will change them all to 255, which is black. I tried to use normal distribution to assign values, or only one is 0 and the others are 255, which can be displayed normally.


After expanding the array to a 3-channel graph, imshow

temp = np.expand_dims(img_area_list[j][1],axis=2).repeat(3,axis=2)
created at:11-22-2021
edited at: 11-22-2021: