class Despeck::ColourChecker
Checks if image is black and white or colourized
Constants
- DE_THRESHOLD
- PERCENT_THRESHOLD
Attributes
de_threshold[R]
image[R]
percent_threshold[R]
Public Class Methods
new(image:, **options)
click to toggle source
# File lib/despeck/colour_checker.rb, line 11 def initialize(image:, **options) @image = image @image = @image.resize(options.fetch(:resize, 1.0)) @percent_threshold = options.fetch(:percent, PERCENT_THRESHOLD) @de_threshold = options.fetch(:de, DE_THRESHOLD) end
Public Instance Methods
black_and_white?()
click to toggle source
# File lib/despeck/colour_checker.rb, line 18 def black_and_white? euclidean_distance = image.colourspace('lch')[1].cast('uchar').percent(percent_threshold) euclidean_distance <= de_threshold end