Class: ShatteredMachine::Sampler

Inherits:
Object
  • Object
show all
Defined in:
lib/shattered_machine/sampler.rb

Overview

A simple weay ro run one, many or all glitch algotirhm on one specific image. This create a quick overview of the effect of each algo for the given image.

Constant Summary collapse

ALL_ALGORITHMS =
%w[brush change_byte defect exchange slim transpose wrong_filter].freeze

Instance Method Summary collapse

Constructor Details

#initialize(io, options = {}) ⇒ Sampler

Returns a new instance of Sampler.

Parameters:

  • io (ShatteredMachine::Io)

    Io containing paths for images to sample

  • options (Hash) (defaults to: {})

    options for specifying which



12
13
14
15
16
# File 'lib/shattered_machine/sampler.rb', line 12

def initialize(io, options = {})
  @io = io
  @base_output_filename = io.output_filename.empty? ? 'sample' : io.output_filename
  @algorithms_to_sample = options[:algorithms_to_sample] || ALL_ALGORITHMS
end

Instance Method Details

#callObject



18
19
20
21
22
23
24
25
26
27
28
# File 'lib/shattered_machine/sampler.rb', line 18

def call
  FILTERS.each do |filter|
    sample_exchange(filter)
    sample_transpose(filter)
    sample_wrong_filter(filter)
  end
  sample_slim
  sample_brush
  sample_change_byte
  sample_defect
end