Class: Tracksperanto::Export::ShakeText

Inherits:
Base
  • Object
show all
Defined in:
lib/export/shake_text.rb

Overview

Export for Shake .txt tracker blobs

Direct Known Subclasses

NukeCameraUsertracks

Constant Summary collapse

PREAMBLE =
"TrackName %s\n   Frame             X             Y   Correlation\n"
POSTAMBLE =
"\n"
TEMPLATE =
"   %.2f   %.3f   %.3f   %.3f"

Instance Attribute Summary

Attributes inherited from Base

#io

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#end_export, inherited, #initialize, #start_export

Methods included from ConstName

#const_name, included

Methods included from SimpleExport

#just_export

Constructor Details

This class inherits a constructor from Tracksperanto::Export::Base

Class Method Details

.desc_and_extensionObject



8
9
10
# File 'lib/export/shake_text.rb', line 8

def self.desc_and_extension
  "shake_trackers.txt"
end

.human_nameObject



12
13
14
# File 'lib/export/shake_text.rb', line 12

def self.human_name
  "Shake trackers in a .txt file"
end

Instance Method Details

#end_tracker_segmentObject



20
21
22
# File 'lib/export/shake_text.rb', line 20

def end_tracker_segment
  @io.puts POSTAMBLE
end

#export_point(frame, abs_float_x, abs_float_y, float_residual) ⇒ Object



24
25
26
27
28
# File 'lib/export/shake_text.rb', line 24

def export_point(frame, abs_float_x, abs_float_y, float_residual)
  # Shake starts from frame 1, not 0
  line = TEMPLATE % [frame + 1, abs_float_x, abs_float_y, 1 - float_residual]
  @io.puts line
end

#start_tracker_segment(tracker_name) ⇒ Object



16
17
18
# File 'lib/export/shake_text.rb', line 16

def start_tracker_segment(tracker_name)
  @io.puts PREAMBLE % tracker_name
end