Module: Hornetseye
- Defined in:
- docs/malloc/lib/malloc_ext.rb,
docs/multiarray/lib/multiarray.rb,
docs/multiarray/lib/multiarray/int.rb,
docs/multiarray/lib/multiarray/lut.rb,
docs/multiarray/lib/multiarray/rgb.rb,
docs/multiarray/lib/multiarray/rgb.rb,
docs/multiarray/lib/multiarray/bool.rb,
docs/multiarray/lib/multiarray/list.rb,
docs/multiarray/lib/multiarray/mask.rb,
docs/multiarray/lib/multiarray/node.rb,
docs/multiarray/lib/multiarray/field.rb,
docs/multiarray/lib/multiarray/float.rb,
docs/multiarray/lib/multiarray/index.rb,
docs/multiarray/lib/multiarray/store.rb,
docs/multiarray/lib/multiarray/inject.rb,
docs/multiarray/lib/multiarray/lambda.rb,
docs/multiarray/lib/multiarray/lookup.rb,
docs/multiarray/lib/multiarray/malloc.rb,
docs/multiarray/lib/multiarray/object.rb,
docs/multiarray/lib/multiarray/random.rb,
docs/multiarray/lib/multiarray/unmask.rb,
docs/multiarray/lib/multiarray/complex.rb,
docs/multiarray/lib/multiarray/complex.rb,
docs/multiarray/lib/multiarray/element.rb,
docs/multiarray/lib/multiarray/gcctype.rb,
docs/multiarray/lib/multiarray/methods.rb,
docs/multiarray/lib/multiarray/pointer.rb,
docs/multiarray/lib/multiarray/argument.rb,
docs/multiarray/lib/multiarray/diagonal.rb,
docs/multiarray/lib/multiarray/gcccache.rb,
docs/multiarray/lib/multiarray/gccvalue.rb,
docs/multiarray/lib/multiarray/integral.rb,
docs/multiarray/lib/multiarray/sequence.rb,
docs/multiarray/lib/multiarray/variable.rb,
docs/multiarray/lib/multiarray/composite.rb,
docs/multiarray/lib/multiarray/histogram.rb,
docs/multiarray/lib/multiarray/shortcuts.rb,
docs/multiarray/lib/multiarray/components.rb,
docs/multiarray/lib/multiarray/gcccontext.rb,
docs/multiarray/lib/multiarray/multiarray.rb,
docs/multiarray/lib/multiarray/operations.rb,
docs/multiarray/lib/multiarray/elementwise.rb,
docs/multiarray/lib/multiarray/gccfunction.rb,
docs/hornetseye-alsa/lib/hornetseye-alsa/docs.rb,
docs/hornetseye-alsa/lib/hornetseye-alsa/alsainput.rb,
docs/hornetseye-alsa/lib/hornetseye-alsa/alsaoutput.rb,
docs/hornetseye-dc1394/lib/hornetseye-dc1394/docs.rb,
docs/hornetseye-dc1394/lib/hornetseye-dc1394/dc1394input.rb,
docs/hornetseye-ffmpeg/lib/hornetseye-ffmpeg/avinput.rb,
docs/hornetseye-ffmpeg/lib/hornetseye-ffmpeg/avoutput.rb,
docs/hornetseye-frame/lib/hornetseye-frame/node.rb,
docs/hornetseye-frame/lib/hornetseye-frame/frame.rb,
docs/hornetseye-frame/lib/hornetseye-frame/fourcc.rb,
docs/hornetseye-frame/lib/hornetseye-frame/shortcuts.rb,
docs/hornetseye-narray/lib/hornetseye-narray/node.rb,
docs/hornetseye-opencv/lib/hornetseye-opencv/node.rb,
docs/hornetseye-openexr/lib/hornetseye-openexr/node.rb,
docs/hornetseye-openexr/lib/hornetseye-openexr/multiarray.rb,
docs/hornetseye-openexr/lib/hornetseye-openexr/openexrinput.rb,
docs/hornetseye-openexr/lib/hornetseye-openexr/openexroutput.rb,
docs/hornetseye-qt4/lib/hornetseye-qt4/xvwidget.rb,
docs/hornetseye-rmagick/lib/hornetseye-rmagick/node.rb,
docs/hornetseye-rmagick/lib/hornetseye-rmagick/multiarray.rb,
docs/hornetseye-v4l2/lib/hornetseye-v4l2/docs.rb,
docs/hornetseye-v4l2/lib/hornetseye-v4l2/v4l2input.rb,
docs/hornetseye-xorg/lib/hornetseye-xorg/node.rb,
docs/hornetseye-xorg/lib/hornetseye-xorg/frame.rb,
docs/hornetseye-xorg/lib/hornetseye-xorg/x11output.rb,
docs/hornetseye-xorg/lib/hornetseye-xorg/x11window.rb,
docs/hornetseye-xorg/lib/hornetseye-xorg/x11display.rb,
docs/hornetseye-xorg/lib/hornetseye-xorg/opengloutput.rb,
docs/hornetseye-xorg/lib/hornetseye-xorg/ximageoutput.rb
Overview
Namespace of Hornetseye computer vision library
Defined Under Namespace
Modules: FrameConstructor, FrameConversion, Methods, MultiArrayConstructor, MultiArrayConversion, ReaderConversion Classes: AVInput, AVOutput, AlsaInput, AlsaOutput, Argument, BOOL, COMPLEX_, Components, Composite, DC1394Input, Diagonal, Element, ElementWise_, FLOAT_, Field_, FourCC, Frame, Frame_, GCCFunction, Histogram, INDEX_, INT_, Inject, Integral, Lambda, List, Lookup, Lut, Malloc, Mask, MultiArray, Node, OBJECT, OpenEXRInput, OpenEXROutput, OpenGLOutput, Pointer_, RGB, RGB_, Random, Sequence, Store, Unmask, V4L2Input, X11Display, X11Output, X11Window, XImageOutput, XvWidget
Constant Summary collapse
- SINGLE =
Boolean constant to use as a parameter for creating floating point classes
The value is
false
. false
- DOUBLE =
Boolean constant to use as a parameter for creating floating point classes
The value is
true
. true
- SFLOAT =
Single-precision floating-point number
FLOAT SINGLE
- DFLOAT =
Double-precision floating-point number
FLOAT DOUBLE
- SCOMPLEX =
Convenience shortcut for single-precision floating-point complex numbers
COMPLEX SFLOAT
- DCOMPLEX =
Convenience shortcut for double-precision floating-point complex numbers
COMPLEX DFLOAT
- BGR =
FourCC 'B', 'G', 'R'
- BGRA =
FourCC 'B', 'G', 'R', 'A'
- UYVY =
FourCC 'U', 'Y', 'V', 'Y'
- YUY2 =
FourCC 'Y', 'U', 'Y', '2'
- I420 =
FourCC 'I', '4', '2', '0'
- YV12 =
FourCC 'Y', 'V', '1', '2'
- MJPG =
FourCC 'M', 'J', 'P', 'G'
- BYTERGB =
24-bit unsigned RGB-triplet
RGB BYTE
- UBYTERGB =
24-bit signed RGB-triplet
RGB UBYTE
- SINTRGB =
48-bit unsigned RGB-triplet
RGB SINT
- USINTRGB =
48-bit signed RGB-triplet
RGB USINT
- INTRGB =
96-bit unsigned RGB-triplet
RGB INT
- UINTRGB =
96-bit signed RGB-triplet
RGB UINT
- LONGRGB =
192-bit unsigned RGB-triplet
RGB LONG
- ULONGRGB =
192-bit signed RGB-triplet
RGB ULONG
- SFLOATRGB =
single precision RGB-triplet
RGB SFLOAT
- DFLOATRGB =
double precision RGB-triplet
RGB DFLOAT
- UNSIGNED =
Boolean constant to use as a parameter for creating integer classes
The value is
false
. false
- SIGNED =
Boolean constant to use as a parameter for creating integer classes
The value is
true
. true
- BYTE =
8-bit signed integer
INT 8, SIGNED
- UBYTE =
8-bit unsigned integer
INT 8, UNSIGNED
- SINT =
16-bit signed integer
INT 16, SIGNED
- USINT =
16-bit unsigned integer
INT 16, UNSIGNED
- INT =
32-bit signed integer
INT 32, SIGNED
- UINT =
32-bit unsigned integer
INT 32, UNSIGNED
- LONG =
64-bit signed integer
INT 64, SIGNED
- ULONG =
64-bit unsigned integer
INT 64, UNSIGNED
Class Method Summary collapse
- .argmax(&action) ⇒ Object
- .argmin(&action) ⇒ Object
- .argument(block, options = {}, &action) ⇒ Object
-
.COMPLEX(element_type) ⇒ Class
Create a class deriving from
COMPLEX_
. -
.finalise(*shape) { ... } ⇒ Object, Node
Method for performing a lazy computation and then forcing the result.
-
.FLOAT(double) ⇒ Class
Create a class deriving from
FLOAT_
. - .FourCC(a, b, c, d = nil) ⇒ Object
- .Frame(typecode) ⇒ Object
-
.INDEX(size) ⇒ Class
Instantiate the type of an array index.
-
.INT(arg, signed = nil) ⇒ Class, INT
Create a class deriving from
INT_
or instantiate anINT
object. -
.lazy(*shape) { ... } ⇒ Object, Node
Method for performing computations in lazy mode resulting in a lazy expression.
-
.Malloc(size) ⇒ Malloc
Shortcut for instantiating Malloc object.
-
.max(*shape) { ... } ⇒ Object, Node
Method for computing maximum of values.
-
.min(*shape) { ... } ⇒ Object, Node
Method for computing minimum of values.
- .MultiArray(typecode, dimension) ⇒ Object
-
.OBJECT(value) ⇒ OBJECT
Shortcut for constructor.
-
.Pointer(target) ⇒ Class
Create a class deriving from
Pointer_
. -
.prod(*shape) { ... } ⇒ Object, Node
Method for computing product of values.
-
.RGB(arg, g = nil, b = nil) ⇒ Class, RGB
Create a class deriving from
RGB_
or instantiate anRGB
object. -
.Sequence(element_type) ⇒ Class
Create a class to represent one-dimensional uniform arrays.
-
.sum(*shape) { ... } ⇒ Object, Node
Method for summing values.
Class Method Details
.argmax(&action) ⇒ Object
926 927 928 |
# File 'docs/multiarray/lib/multiarray.rb', line 926 def argmax(&action) argument proc { |a,b| a > b }, &action end |
.argmin(&action) ⇒ Object
932 933 934 |
# File 'docs/multiarray/lib/multiarray.rb', line 932 def argmin(&action) argument proc { |a,b| a < b }, &action end |
.argument(block, options = {}, &action) ⇒ Object
890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 |
# File 'docs/multiarray/lib/multiarray.rb', line 890 def argument(block, = {}, &action) arity = [:arity] || action.arity if arity > 0 indices = [:indices] || (0 ... arity).collect { Variable.new Hornetseye::INDEX(nil) } term = [:term] || action.call(*indices) slices = indices[0 ... -1].inject(term) { |t,index| Lambda.new index, t } var1 = [:var1] || Variable.new(term.typecode) var2 = [:var2] || Variable.new(term.typecode) block = [:block] || block.call( var1, var2 ) lut = Argument.new(slices, indices.last, block, var1, var2, INT.new(0)).force arr = [:arr] || Lambda.new(indices.last, slices) id = (0 ... arr.dimension - 1).collect { |j| lazy(*arr.shape[0 ... -1]) { |*i| i[j] } } lut = INT.new(lut) unless lut.matched? sub_arr = Lut.new(*(id + [lut] + [arr])).force indices = (0 ... arity - 1).collect { Variable.new Hornetseye::INDEX(nil) } term = indices.reverse.inject(sub_arr) { |t,index| t.element index } sub_arg = argument nil, :arity => arity - 1, :indices => indices, :term => term, :arr => sub_arr, :block => block, :var1 => var1, :var2 => var2 if sub_arg.empty? [lut[]] elsif sub_arg.first.is_a? Integer sub_arg + [lut[*sub_arg]] else id = (0 ... sub_arg.first.dimension).collect do |i| lazy(*sub_arg.first.shape) { |*j| j[i] } end sub_arg + [lut.warp(*(id + sub_arg))] end else [] end end |
.COMPLEX(element_type) ⇒ Class
Create a class deriving from COMPLEX_
Create a class deriving from COMPLEX_
. The parameter element_type
is assigned to the corresponding attribute of the resulting class.
1064 1065 1066 |
# File 'docs/multiarray/lib/multiarray/complex.rb', line 1064 def COMPLEX( element_type ) COMPLEX_.inherit element_type end |
.finalise(*shape) { ... } ⇒ Object, Node
Method for performing a lazy computation and then forcing the result
attempts to infer the shape if not specified.
798 799 800 801 802 803 804 805 806 807 |
# File 'docs/multiarray/lib/multiarray.rb', line 798 def finalise( *shape, &action ) previous = Thread.current[ :lazy ] Thread.current[ :lazy ] = false begin retval = lazy *shape, &action retval.matched? ? retval.force : retval ensure Thread.current[ :lazy ] = previous end end |
.FLOAT(double) ⇒ Class
Create a class deriving from FLOAT_
Create a class deriving from FLOAT_
. The parameters double
is assigned to the corresponding attributes of the resulting class.
242 243 244 |
# File 'docs/multiarray/lib/multiarray/float.rb', line 242 def FLOAT(double) FLOAT_.inherit double end |
.FourCC(a, b, c, d = nil) ⇒ Object
48 49 50 |
# File 'docs/hornetseye-frame/lib/hornetseye-frame/fourcc.rb', line 48 def FourCC(a, b, c, d = nil) FourCC.new a, b, c, d end |
.Frame(typecode) ⇒ Object
145 146 147 148 149 150 151 152 153 |
# File 'docs/hornetseye-frame/lib/hornetseye-frame/frame.rb', line 145 def Frame(typecode) if typecode.is_a? FourCC retval = Class.new Frame_ retval.typecode = typecode retval else Hornetseye::MultiArray typecode, 2 end end |
.INDEX(size) ⇒ Class
Instantiate the type of an array index
115 116 117 118 119 120 |
# File 'docs/multiarray/lib/multiarray/index.rb', line 115 def INDEX( size ) retval = Class.new INDEX_ size = INT.new(size) unless size.matched? retval.size = size retval end |
.INT(bits, signed) ⇒ Class .INT(value) ⇒ INT
Create a class deriving from INT_
or instantiate an INT
object
307 308 309 310 311 312 313 |
# File 'docs/multiarray/lib/multiarray/int.rb', line 307 def INT( arg, signed = nil ) if signed.nil? INT.new arg else INT_.inherit arg, signed end end |
.lazy(*shape) { ... } ⇒ Object, Node
Method for performing computations in lazy mode resulting in a lazy expression
attempts to infer the shape if not specified.
767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 |
# File 'docs/multiarray/lib/multiarray.rb', line 767 def lazy( *shape, &action ) previous = Thread.current[ :lazy ] Thread.current[ :lazy ] = true begin = shape.last.is_a?( Hash ) ? shape.pop : {} arity = [ :arity ] || [ action.arity, shape.size ].max if arity <= 0 action.call else index = Variable.new shape.empty? ? Hornetseye::INDEX( nil ) : Hornetseye::INDEX( shape.pop ) term = lazy *( shape + [ :arity => arity - 1 ] ) do |*args| action.call *( args + [ index ] ) end term = Node.match(term).new term unless term.matched? Lambda.new index, term end ensure Thread.current[ :lazy ] = previous end end |
.Malloc(size) ⇒ Malloc
Shortcut for instantiating Malloc object
237 238 239 |
# File 'docs/malloc/lib/malloc_ext.rb', line 237 def Malloc( size ) Malloc.new size end |
.max(*shape) { ... } ⇒ Object, Node
Method for computing maximum of values
884 885 886 |
# File 'docs/multiarray/lib/multiarray.rb', line 884 def max(*shape, &action) inject *(shape + [proc { |a,b| a.major b }]), &action end |
.min(*shape) { ... } ⇒ Object, Node
Method for computing minimum of values
872 873 874 |
# File 'docs/multiarray/lib/multiarray.rb', line 872 def min(*shape, &action) inject *(shape + [proc { |a,b| a.minor b }]), &action end |
.MultiArray(typecode, dimension) ⇒ Object
99 100 101 102 103 104 105 |
# File 'docs/multiarray/lib/multiarray/multiarray.rb', line 99 def MultiArray(typecode, dimension) if dimension > 0 Field_.inherit typecode.typecode, typecode.dimension + dimension else Hornetseye::Pointer typecode end end |
.OBJECT(value) ⇒ OBJECT
Shortcut for constructor
The method calls OBJECT.new
.
165 166 167 |
# File 'docs/multiarray/lib/multiarray/object.rb', line 165 def OBJECT( value ) OBJECT.new value end |
.Pointer(target) ⇒ Class
Create a class deriving from Pointer_
Create a class deriving from Pointer_
. The parameter target
is assigned to the corresponding attribute of the resulting class.
274 275 276 277 278 |
# File 'docs/multiarray/lib/multiarray/pointer.rb', line 274 def Pointer( target ) p = Class.new Pointer_ p.target = target p end |
.prod(*shape) { ... } ⇒ Object, Node
Method for computing product of values
860 861 862 |
# File 'docs/multiarray/lib/multiarray.rb', line 860 def prod(*shape, &action) inject *(shape + [proc { |a,b| a * b }]), &action end |
.RGB(element_type) ⇒ Class .RGB(r, g, b) ⇒ RGB
Create a class deriving from RGB_
or instantiate an RGB
object
697 698 699 700 701 702 703 |
# File 'docs/multiarray/lib/multiarray/rgb.rb', line 697 def RGB( arg, g = nil, b = nil ) if g.nil? and b.nil? RGB_.inherit arg else RGB.new arg, g, b end end |
.Sequence(element_type) ⇒ Class
Create a class to represent one-dimensional uniform arrays
82 83 84 |
# File 'docs/multiarray/lib/multiarray/sequence.rb', line 82 def Sequence(element_type) Hornetseye::MultiArray element_type, 1 end |