Module: ColorDecomposition

Defined in:
lib/color_decomposition.rb,
lib/color_decomposition/image.rb,
lib/color_decomposition/version.rb,
lib/color_decomposition/color/color.rb,
lib/color_decomposition/quadtree/node.rb,
lib/color_decomposition/color/comparator.rb,
lib/color_decomposition/quadtree/quadtree.rb

Defined Under Namespace

Modules: Comparator Classes: Color, Image, Node, Quadtree

Constant Summary collapse

VERSION =
'0.0.3'.freeze

Class Method Summary collapse

Class Method Details

.quadtree(path, similarity) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/color_decomposition.rb', line 8

def quadtree(path, similarity)
  unless similarity.between?(0, 100)
    raise ArgumentError, 'Similarity value must be between 0 and 100'
  end
  image = Image.new(path)
  puts 'Generating initial quadtree structure'
  quadtree = Quadtree.new(image.width, image.height)
  image.add_image_data(quadtree)
  puts 'Checking quadtree levels'
  quadtree.generate_similarity_tree(similarity)
  puts 'Quadtree complete'
  quadtree.root
end