Class: Sqed::BoundaryFinder::ColorLineFinder

Inherits:
Sqed::BoundaryFinder show all
Defined in:
lib/sqed/boundary_finder/color_line_finder.rb

Overview

An agnostic pattern finder for color-line delimited boundaries

Constant Summary

Constants inherited from Sqed::BoundaryFinder

COLOR_DELTA, THUMB_SIZE

Instance Attribute Summary collapse

Attributes inherited from Sqed::BoundaryFinder

#boundaries, #image, #layout, #original_image, #use_thumbnail

Instance Method Summary collapse

Methods inherited from Sqed::BoundaryFinder

color_boundary_finder, derivative, derivative_signs, frequency_stats, get_subdivision_size, #height_factor, is_black?, is_blue?, is_green?, is_red?, #longest_thumbnail_axis, max_difference, max_pairwise_difference, sample_border, #thumbnail, #thumbnail_height, #thumbnail_width, #width_factor, #zoom_boundaries

Constructor Details

#initialize(**opts) ⇒ ColorLineFinder

Returns a new instance of ColorLineFinder.

Raises:



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/sqed/boundary_finder/color_line_finder.rb', line 9

def initialize(**opts)
  # image: image, layout: layout, boundary_color: :green, use_thumbnail: true)
  image = opts[:image]
  layout = opts[:layout]
  use_thumbnail = opts[:use_thumbnail]
  @boundary_color = opts[:boundary_color] || :green

  super(image: image, layout: layout, use_thumbnail: use_thumbnail)

  raise Sqed::Error, 'No layout provided.' if @layout.nil?

  # !@#? why this
  @boundary_color = boundary_color

  if use_thumbnail
    @original_image = @image.copy
    @image = thumbnail
  end
  find_bands
end

Instance Attribute Details

#boundary_colorObject

Returns the value of attribute boundary_color.



7
8
9
# File 'lib/sqed/boundary_finder/color_line_finder.rb', line 7

def boundary_color
  @boundary_color
end