Class: Tracksperanto::Keyframe

Inherits:
Object
  • Object
show all
Includes:
Comparable, BlockInit, Casts
Defined in:
lib/tracksperanto/keyframe.rb

Overview

Internal representation of a keyframe, that carries info on the frame location in the clip, x y and residual.

Franme numbers are zero-based (frame 0 is first frame of the clip). X-coordinate (abs_x) is absolute pixels from lower left corner of the comp to the right Y-coordinate (abs_y) is absolute pixels from lower left corner of the comp up Residual is how far in pixels the tracker strolls away, and is the inverse of correlation (with total correlation of one the residual excursion becomes zero).

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Casts

#cast_to_bool, #cast_to_float, #cast_to_int, #cast_to_string

Methods included from BlockInit

#initialize

Instance Attribute Details

#abs_xObject

Float X value of the point, zero is lower left


15
16
17
# File 'lib/tracksperanto/keyframe.rb', line 15

def abs_x
  @abs_x
end

#abs_yObject

Float Y value of the point, zero is lower left


18
19
20
# File 'lib/tracksperanto/keyframe.rb', line 18

def abs_y
  @abs_y
end

#frameObject

Integer frame where this keyframe is placed, 0-based


12
13
14
# File 'lib/tracksperanto/keyframe.rb', line 12

def frame
  @frame
end

#residualObject

Float residual (0 is “spot on”)


21
22
23
# File 'lib/tracksperanto/keyframe.rb', line 21

def residual
  @residual
end

Instance Method Details

#<=>(another) ⇒ Object


30
31
32
# File 'lib/tracksperanto/keyframe.rb', line 30

def <=>(another)
  [frame, abs_x, abs_y, residual] <=> [another.frame, another.abs_x, another.abs_y, another.residual]
end

#inspectObject


26
27
28
# File 'lib/tracksperanto/keyframe.rb', line 26

def inspect
  '#< %.1fx%.1f @%d ~%.2f) >' %  [abs_x, abs_y, frame, residual]
end