Element-wise Logarithm

The element-wise logarithm can be used to display images with a large contrast range.

#!/usr/bin/env ruby
require 'hornetseye'
include Hornetseye
raise "Syntax: logarithm.rb <input file> <output file>" if ARGV.size != 2
img = MultiArray.load_sfloat ARGV[0]
Math.log( img + 0.1 ).normalise.save_ubyte ARGV[1]
Close