소스 뷰어
from matplotlib import pyplot as plt
img = plt.imread( 'messi5.jpg' )
# split the image into 3 channel data
red = img[:, :, 0] # blue channel data
green = img[:, :, 1] # green channel data
blue = img[:, :, 2] # red channel data
fusion1 = blue/3 + green/3 + red/3
print( "fustion1.dtype = ", fusion1.dtype )
plt.imshow( fusion1, cmap='gray' )
plt.show()
import numpy as np
from matplotlib import pyplot as plt
img = plt.imread( 'messi5.jpg' )
# split the image into 3 channel data
red = img[:, :, 0] # blue channel data
green = img[:, :, 1] # green channel data
blue = img[:, :, 2] # red channel data
fusion2 = (blue + green + red)/3 # overflow 발생 => 에러
print( "fustion2.dtype = ", fusion2.dtype )
plt.imshow( fusion2 , cmap='gray' )
plt.show()