class Tracksperanto::Export::PFMatchit

Export for PFMatchit

Constants

KEYFRAME_TEMPLATE

Public Class Methods

desc_and_extension() click to toggle source
# File lib/export/pfmatchit.rb, line 8
def self.desc_and_extension
  "pftrack_2011_pfmatchit.txt"
end
human_name() click to toggle source
# File lib/export/pfmatchit.rb, line 12
def self.human_name
  "PFTrack2011/PFMatchit .txt file (single camera)"
end

Public Instance Methods

end_tracker_segment() click to toggle source

TODO: currently exports to one camera

# File lib/export/pfmatchit.rb, line 29
def end_tracker_segment
  2.times { @io.write(linebreak) }
  @io.write(@tracker_name.inspect) # autoquotes
  @io.write linebreak
  @io.write camera_name # For primary/secondary cam in stereo pair
  @io.write linebreak
  @io.write @frame_count
  @io.write linebreak
  
  @tracker_io.rewind
  @io.write(@tracker_io.read) until @tracker_io.eof?
  @tracker_io.close!
end
export_point(frame, abs_float_x, abs_float_y, float_residual) click to toggle source
# File lib/export/pfmatchit.rb, line 43
def export_point(frame, abs_float_x, abs_float_y, float_residual)
  @frame_count += 1
  line = KEYFRAME_TEMPLATE % [frame_number(frame), to_pfcoord(abs_float_x), to_pfcoord(abs_float_y), float_residual / 8]
  @tracker_io.write(line)
  @tracker_io.write(linebreak)
end
start_export(w, h) click to toggle source
# File lib/export/pfmatchit.rb, line 16
def start_export(w, h)
  @width = w
  @height = h
end
start_tracker_segment(tracker_name) click to toggle source
# File lib/export/pfmatchit.rb, line 21
def start_tracker_segment(tracker_name)
  # Setup for the next tracker
  @frame_count = 0
  @tracker_name = tracker_name
  @tracker_io = Tracksperanto::BufferIO.new
end

Private Instance Methods

camera_name() click to toggle source
# File lib/export/pfmatchit.rb, line 60
def camera_name
  "1"
end
frame_number(tracksperanto_frame) click to toggle source
# File lib/export/pfmatchit.rb, line 52
def frame_number(tracksperanto_frame)
  tracksperanto_frame + 1
end
linebreak() click to toggle source
# File lib/export/pfmatchit.rb, line 56
def linebreak
  "\n"
end