Class: ImageCompare::Modes::RGB
- Inherits:
-
Base
- Object
- Base
- ImageCompare::Modes::RGB
show all
- Defined in:
- lib/image_compare/modes/rgb.rb
Instance Attribute Summary
Attributes inherited from Base
#bounds, #exclude_rect, #include_rect, #lower_threshold, #result, #threshold
Instance Method Summary
collapse
Methods inherited from Base
#area, #compare, #diff, #initialize, #score, #update_bounds
#blue, #brightness, #green, #orange, #red, #transparent, #yellow
Instance Method Details
#background(bg) ⇒ Object
17
18
19
|
# File 'lib/image_compare/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/image_compare/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/image_compare/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/image_compare/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/image_compare/modes/rgb.rb', line 12
def update_result(a, b, x, y)
super
@result.diff << [a, b, x, y]
end
|