Class: Player::Blob
- Inherits:
-
Object
- Object
- Player::Blob
- Defined in:
- lib/ruby-player/blob.rb
Overview
Classs describing a single blob.
Instance Attribute Summary collapse
-
#state ⇒ Hash
readonly
Blob description => { :id, :color, :area, :x, :y, :left, :right, :top, :bottom, :range }.
Instance Method Summary collapse
-
#area ⇒ Integer
The blob area [pixels].
-
#bottom ⇒ Object
Bounding box for the blob [pixels].
-
#color ⇒ Integer
A descriptive color for the blob (useful for gui’s).
-
#id ⇒ Integer
Blob id.
-
#initialize(index, blobfinder) ⇒ Blob
constructor
A new instance of Blob.
-
#left ⇒ Object
Bounding box for the blob [pixels].
-
#range ⇒ Object
Range to the blob center [m].
-
#right ⇒ Object
Bounding box for the blob [pixels].
-
#top ⇒ Object
Bounding box for the blob [pixels].
-
#x ⇒ Object
The blob centroid [pixels].
-
#y ⇒ Object
The blob centroid [pixels].
Constructor Details
#initialize(index, blobfinder) ⇒ Blob
Returns a new instance of Blob.
21 22 23 24 |
# File 'lib/ruby-player/blob.rb', line 21 def initialize(index, blobfinder) @index, @blobfinder = index, blobfinder @state = { id: 0, color: 0, area: 0, x: 0, y: 0, left: 0, right: 0, top: 0, bottom: 0, range: 0.0 } end |
Instance Attribute Details
#state ⇒ Hash (readonly)
Returns blob description => { :id, :color, :area, :x, :y, :left, :right, :top, :bottom, :range }.
19 20 21 |
# File 'lib/ruby-player/blob.rb', line 19 def state @state end |
Instance Method Details
#area ⇒ Integer
The blob area [pixels].
40 41 42 |
# File 'lib/ruby-player/blob.rb', line 40 def area state[:area] end |
#bottom ⇒ Object
Bounding box for the blob [pixels].
70 71 72 |
# File 'lib/ruby-player/blob.rb', line 70 def bottom state[:bottom] end |
#color ⇒ Integer
A descriptive color for the blob (useful for gui’s).
34 35 36 |
# File 'lib/ruby-player/blob.rb', line 34 def color state[:color] end |
#id ⇒ Integer
Blob id
28 29 30 |
# File 'lib/ruby-player/blob.rb', line 28 def id state[:id] end |
#left ⇒ Object
Bounding box for the blob [pixels].
55 56 57 |
# File 'lib/ruby-player/blob.rb', line 55 def left state[:left] end |
#range ⇒ Object
Range to the blob center [m].
75 76 77 |
# File 'lib/ruby-player/blob.rb', line 75 def range state[:range] end |
#right ⇒ Object
Bounding box for the blob [pixels].
60 61 62 |
# File 'lib/ruby-player/blob.rb', line 60 def right state[:right] end |
#top ⇒ Object
Bounding box for the blob [pixels].
65 66 67 |
# File 'lib/ruby-player/blob.rb', line 65 def top state[:top] end |
#x ⇒ Object
The blob centroid [pixels].
45 46 47 |
# File 'lib/ruby-player/blob.rb', line 45 def x state[:x] end |
#y ⇒ Object
The blob centroid [pixels].
50 51 52 |
# File 'lib/ruby-player/blob.rb', line 50 def y state[:y] end |