matplotlib.pyplot의 gray image 출력이 이상하다면

흑백이미지를 준비하고

 

etc-image-0

 

 

matplotlib.pyplot에서 plt.imshow로 출력을 해보면

 

etc-image-1

 

 

 

 

cmap이라는 옵션을 줘야한다

 

color map이라는 뜻인데

 

etc-image-2

 

 

기본값이 viridis라고 한다. 실제로 색이 비슷한걸 보니 그런것 같다

 

 

etc-image-3

 

 

 

etc-image-4

 

 

 

This parameter is ignored if X is RGB(A).

 

마지막에 이런 문장이 있는데, X가 RGB image면 cmap을 무시한다고 한다

 

channel 3인 gray image로 줬을 때는 cmap을 안줘도 gray로 잘 나온다

 

etc-image-5

 

 

 

728x90