Class: Imatcher::Result
- Inherits:
-
Object
- Object
- Imatcher::Result
- Defined in:
- lib/imatcher/result.rb
Overview
Object containing comparison score and diff image
Instance Attribute Summary collapse
-
#diff ⇒ Object
readonly
Returns the value of attribute diff.
-
#image ⇒ Object
Returns the value of attribute image.
-
#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) ⇒ Result
constructor
A new instance of Result.
-
#match? ⇒ Boolean
Returns true iff score less or equals to threshold.
Constructor Details
#initialize(mode, threshold) ⇒ Result
Returns a new instance of Result.
7 8 9 10 11 12 |
# File 'lib/imatcher/result.rb', line 7 def initialize(mode, threshold) @score = 0.0 @diff = [] @threshold = threshold @mode = mode end |
Instance Attribute Details
#diff ⇒ Object (readonly)
Returns the value of attribute diff.
5 6 7 |
# File 'lib/imatcher/result.rb', line 5 def diff @diff end |
#image ⇒ Object
Returns the value of attribute image.
4 5 6 |
# File 'lib/imatcher/result.rb', line 4 def image @image end |
#mode ⇒ Object (readonly)
Returns the value of attribute mode.
5 6 7 |
# File 'lib/imatcher/result.rb', line 5 def mode @mode end |
#score ⇒ Object
Returns the value of attribute score.
4 5 6 |
# File 'lib/imatcher/result.rb', line 4 def score @score end |
#threshold ⇒ Object (readonly)
Returns the value of attribute threshold.
5 6 7 |
# File 'lib/imatcher/result.rb', line 5 def threshold @threshold end |
Instance Method Details
#difference_image ⇒ Object
14 15 16 |
# File 'lib/imatcher/result.rb', line 14 def difference_image @diff_image ||= mode.diff(image, diff) end |
#match? ⇒ Boolean
Returns true iff score less or equals to threshold
19 20 21 |
# File 'lib/imatcher/result.rb', line 19 def match? score <= threshold end |