Sha256: 2ea49680924ecc4a4b175fd15b7ebcc116c38a275af2a07be843671b2274f91a
Contents?: true
Size: 1.04 KB
Versions: 5
Compression:
Stored size: 1.04 KB
Contents
class Tracksperanto::Import::Syntheyes < Tracksperanto::Import::Base def self.human_name "Syntheyes tracker export (UV) file" end def parse(io) trackers = [] io.each_line do | line | name, frame, x, y, corr = line.split # Do we already have this tracker? t = trackers.find {|e| e.name == name} if !t report_progress("Allocating tracker #{name}") t = Tracksperanto::Tracker.new{|t| t.name = name } trackers << t end # Add the keyframe t.keyframes << Tracksperanto::Keyframe.new do |e| e.frame = frame e.abs_x = convert_from_uv(width, x) e.abs_y = height - convert_from_uv(height, y) # Convert TL to BL e.residual = corr end report_progress("Adding keyframe #{frame} to #{name}") end trackers end private def convert_from_uv(absolute_side, uv_value) # First, start from zero (-.1 becomes .4) value_off_corner = (uv_value.to_f / 2) + 0.5 absolute_side * value_off_corner end end
Version data entries
5 entries across 5 versions & 1 rubygems