Class: CVFFI::ImagePatch::SquareMask

Inherits:
Mask
  • Object
show all
Defined in:
lib/opencv-ffi-wrappers/features2d/image_patch.rb

Instance Attribute Summary

Attributes inherited from Mask

#size

Instance Method Summary collapse

Methods inherited from Mask

make

Constructor Details

#initialize(size) ⇒ SquareMask

Returns a new instance of SquareMask.



31
32
33
# File 'lib/opencv-ffi-wrappers/features2d/image_patch.rb', line 31

def initialize(size)
  super(size)
end

Instance Method Details

#to_aObject



38
39
40
# File 'lib/opencv-ffi-wrappers/features2d/image_patch.rb', line 38

def to_a
  Array.new(size) { |i| Array.new(size) { |j| true } }
end

#valid?(i, j) ⇒ Boolean

Returns:

  • (Boolean)


34
35
36
37
# File 'lib/opencv-ffi-wrappers/features2d/image_patch.rb', line 34

def valid?(i,j)
  raise "Requesting point outside mask" unless ((0...@size).include? i and (0...@size).include? j) 
  true
end