Module: Imagine
- Defined in:
- lib/imagine.rb
Instance Method Summary collapse
Instance Method Details
#compare_image_to(image) ⇒ Object
2 3 4 5 6 7 8 9 10 11 |
# File 'lib/imagine.rb', line 2 def compare_image_to(image) # http://en.wikipedia.org/wiki/RMSD aggregate_deviation = 0.0 target_image.each_pixel do |target_pixel, x, y| aggregate_deviation += compare_pixels(target_pixel, image.pixel_color(x, y)) end 1 - Math.sqrt(aggregate_deviation / (Magick::MaxRGB ** 2 * image_dimensions.x * image_dimensions.y * 3)) end |