Class: SnapDiff::ImagePreprocessor
- Inherits:
-
Object
- Object
- SnapDiff::ImagePreprocessor
- Defined in:
- lib/snap_diff/image_preprocessor.rb
Overview
Handles image preprocessing operations (skip_area and median filtering)
This class applies preprocessing filters to images before comparison, such as masking specific regions (skip_area) or applying noise reduction. It's designed to work with either direct image objects or with options.
Instance Attribute Summary collapse
-
#driver ⇒ Object
readonly
Returns the value of attribute driver.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(driver, options = {}) ⇒ ImagePreprocessor
constructor
A new instance of ImagePreprocessor.
-
#process_comparison(comparison) ⇒ Comparison
Process a comparison object directly This allows reusing the comparison's existing options.
Constructor Details
#initialize(driver, options = {}) ⇒ ImagePreprocessor
Returns a new instance of ImagePreprocessor.
12 13 14 15 |
# File 'lib/snap_diff/image_preprocessor.rb', line 12 def initialize(driver, = {}) @driver = driver @options = end |
Instance Attribute Details
#driver ⇒ Object (readonly)
Returns the value of attribute driver.
10 11 12 |
# File 'lib/snap_diff/image_preprocessor.rb', line 10 def driver @driver end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
10 11 12 |
# File 'lib/snap_diff/image_preprocessor.rb', line 10 def @options end |
Instance Method Details
#process_comparison(comparison) ⇒ Comparison
Process a comparison object directly This allows reusing the comparison's existing options
21 22 23 24 25 26 27 |
# File 'lib/snap_diff/image_preprocessor.rb', line 21 def process_comparison(comparison) # Process both images comparison.base_image = process_image(comparison.base_image, comparison.base_image_path) comparison.new_image = process_image(comparison.new_image, comparison.new_image_path) comparison end |