Class: OpenCV::CvAvgComp

Inherits:
Object
  • Object
show all
Defined in:
lib/detectors/opencv_ext.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#colorObject

Returns the value of attribute color.



3
4
5
# File 'lib/detectors/opencv_ext.rb', line 3

def color
  @color
end

Instance Method Details

#<(comp) ⇒ Object



18
19
20
# File 'lib/detectors/opencv_ext.rb', line 18

def <(comp)
  self.area < comp.area
end

#>(comp) ⇒ Object



14
15
16
# File 'lib/detectors/opencv_ext.rb', line 14

def >(comp)
  self.area > comp.area
end

#areaObject



23
24
25
# File 'lib/detectors/opencv_ext.rb', line 23

def area
  return self.width * self.height
end

#collide?(comp) ⇒ Boolean

collide?

Returns:

  • (Boolean)


7
8
9
10
11
12
# File 'lib/detectors/opencv_ext.rb', line 7

def collide?(comp)
  if (self.x < comp.x + comp.width && comp.x < self.x + self.width && self.y < comp.y + comp.height)
    return comp.y < self.y + self.height
  end
  return false
end

#to_sObject



27
28
29
# File 'lib/detectors/opencv_ext.rb', line 27

def to_s
  "#{self.x},#{self.y}-#{self.width}x#{self.height}"
end