Slide 20
Slide 20 text
require 'RMagick'
image = ImageList.new('image.jpg')
red_extrema = image.channel_extrema(Magick::RedChannel)
green_extrema = image.channel_extrema(Magick::GreenChannel)
blue_extrema = image.channel_extrema(Magick::BlueChannel)
red_max = red_extrema.last.to_f
green_max = green_extrema.last.to_f
blue_max = blue_extrema.last.to_f
white_balanced_image = image
white_balanced_image = white_balanced_image.convolve_channel(1,
[green_max / red_max], Magick::RedChannel)
white_balanced_image = white_balanced_image.convolve_channel(1,
[green_max / blue_max], Magick::BlueChannel)
3.BHJDLʹΑΔ3FUJOFY