Class: ImageCompare::Result
- Inherits:
-
Object
- Object
- ImageCompare::Result
- Defined in:
- lib/image_compare/result.rb
Instance Attribute Summary collapse
-
#diff ⇒ Object
readonly
Returns the value of attribute diff.
-
#image ⇒ Object
Returns the value of attribute image.
-
#lower_threshold ⇒ Object
readonly
Returns the value of attribute lower_threshold.
-
#mode ⇒ Object
readonly
Returns the value of attribute mode.
-
#score ⇒ Object
Returns the value of attribute score.
-
#threshold ⇒ Object
readonly
Returns the value of attribute threshold.
Instance Method Summary collapse
- #difference_image ⇒ Object
-
#initialize(mode, threshold:, lower_threshold:) ⇒ Result
constructor
A new instance of Result.
- #match? ⇒ Boolean
Constructor Details
#initialize(mode, threshold:, lower_threshold:) ⇒ Result
Returns a new instance of Result.
8 9 10 11 12 13 14 |
# File 'lib/image_compare/result.rb', line 8 def initialize(mode, threshold:, lower_threshold:) @score = 0.0 @diff = [] @threshold = threshold @lower_threshold = lower_threshold @mode = mode end |
Instance Attribute Details
#diff ⇒ Object (readonly)
Returns the value of attribute diff.
6 7 8 |
# File 'lib/image_compare/result.rb', line 6 def diff @diff end |
#image ⇒ Object
Returns the value of attribute image.
5 6 7 |
# File 'lib/image_compare/result.rb', line 5 def image @image end |
#lower_threshold ⇒ Object (readonly)
Returns the value of attribute lower_threshold.
6 7 8 |
# File 'lib/image_compare/result.rb', line 6 def lower_threshold @lower_threshold end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
6 7 8 |
# File 'lib/image_compare/result.rb', line 6 def mode @mode end |
#score ⇒ Object
Returns the value of attribute score.
5 6 7 |
# File 'lib/image_compare/result.rb', line 5 def score @score end |
#threshold ⇒ Object (readonly)
Returns the value of attribute threshold.
6 7 8 |
# File 'lib/image_compare/result.rb', line 6 def threshold @threshold end |
Instance Method Details
#difference_image ⇒ Object
16 17 18 |
# File 'lib/image_compare/result.rb', line 16 def difference_image @diff_image ||= mode.diff(image, diff) end |
#match? ⇒ Boolean
20 21 22 |
# File 'lib/image_compare/result.rb', line 20 def match? score <= threshold && score >= lower_threshold end |