Class: Imatcher::Modes::RGB
- Inherits:
-
Base
- Object
- Base
- Imatcher::Modes::RGB
show all
- Defined in:
- lib/imatcher/modes/rgb.rb
Overview
Compare pixels by values. Resulting image contains per-channel differences.
Instance Attribute Summary
Attributes inherited from Base
#bounds, #result, #threshold
Instance Method Summary
collapse
Methods inherited from Base
#compare, #diff, #initialize, #score, #update_bounds
#brightness
Instance Method Details
#background(bg) ⇒ Object
17
18
19
|
# File 'lib/imatcher/modes/rgb.rb', line 17
def background(bg)
Image.new(bg.width, bg.height, BLACK)
end
|
#create_diff_image(bg, diff_image) ⇒ Object
21
22
23
|
# File 'lib/imatcher/modes/rgb.rb', line 21
def create_diff_image(bg, diff_image)
diff_image
end
|
#pixels_diff(d, a, b, x, y) ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/imatcher/modes/rgb.rb', line 25
def pixels_diff(d, a, b, x, y)
d[x, y] = rgb(
(r(a) - r(b)).abs,
(g(a) - g(b)).abs,
(b(a) - b(b)).abs
)
end
|
#pixels_equal?(a, b) ⇒ Boolean
8
9
10
|
# File 'lib/imatcher/modes/rgb.rb', line 8
def pixels_equal?(a, b)
a == b
end
|
#update_result(a, b, x, y) ⇒ Object
12
13
14
15
|
# File 'lib/imatcher/modes/rgb.rb', line 12
def update_result(a, b, x, y)
super
@result.diff << [a, b, x, y]
end
|