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, included

Methods included from BlockInit

#initialize

Instance Attribute Details

#abs_xObject

Float X value of the point, zero is lower left



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

def abs_x
  @abs_x
end

#abs_yObject

Float Y value of the point, zero is lower left



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

def abs_y
  @abs_y
end

#frameObject

Integer frame where this keyframe is placed, 0-based



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

def frame
  @frame
end

#residualObject

Float residual (0 is “spot on”)



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

def residual
  @residual
end

Instance Method Details

#<=>(another) ⇒ Object



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

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

#inspectObject



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

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