Class: CVFFI::ImagePatch::SquareMask
- Defined in:
- lib/opencv-ffi-wrappers/features2d/image_patch.rb
Instance Attribute Summary
Attributes inherited from Mask
Instance Method Summary collapse
-
#initialize(size) ⇒ SquareMask
constructor
A new instance of SquareMask.
- #to_a ⇒ Object
- #valid?(i, j) ⇒ Boolean
Methods inherited from Mask
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_a ⇒ Object
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
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 |