Sha256: bae3abdc56ff8c9f91e9c093ce5c5d3da31782477bd66a02c94b97f9dc73a9c4

Contents?: true

Size: 807 Bytes

Versions: 40

Compression:

Stored size: 807 Bytes

Contents

# This middleware removes trackers that contain less than min_length keyframes
# from the exported batch
class Tracksperanto::Middleware::LengthCutoff < Tracksperanto::Middleware::Base
  attr_accessor :min_length
  cast_to_int :min_length
  
  def start_tracker_segment(name)
    @tracker = Tracksperanto::Tracker.new(:name => name)
  end
  
  def end_tracker_segment
    return if ((min_length > 0)  && (@tracker.length < min_length))
    
    @exporter.start_tracker_segment(@tracker.name)
    @tracker.each{|kf| @exporter.export_point(kf.frame, kf.abs_x, kf.abs_y, kf.residual) }
    @exporter.end_tracker_segment
  end
  
  def export_point(frame, float_x, float_y, float_residual)
    @tracker.keyframe! :abs_x => float_x, :abs_y => float_y, :residual => float_residual, :frame => frame
  end
  
  
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
tracksperanto-2.1.1 lib/middleware/length_cutoff.rb
tracksperanto-2.1.0 lib/middleware/length_cutoff.rb
tracksperanto-2.0.2 lib/middleware/length_cutoff.rb
tracksperanto-2.0.1 lib/middleware/length_cutoff.rb
tracksperanto-2.0.0 lib/middleware/length_cutoff.rb
tracksperanto-1.9.9 lib/middleware/length_cutoff.rb
tracksperanto-1.9.8 lib/middleware/length_cutoff.rb
tracksperanto-1.9.6 lib/middleware/length_cutoff.rb
tracksperanto-1.9.5 lib/middleware/length_cutoff.rb
tracksperanto-1.9.4 lib/middleware/length_cutoff.rb
tracksperanto-1.9.3 lib/middleware/length_cutoff.rb
tracksperanto-1.9.2 lib/middleware/length_cutoff.rb
tracksperanto-1.9.1 lib/middleware/length_cutoff.rb
tracksperanto-1.9.0 lib/middleware/length_cutoff.rb
tracksperanto-1.8.4 lib/middleware/length_cutoff.rb
tracksperanto-1.8.2 lib/middleware/length_cutoff.rb
tracksperanto-1.8.1 lib/middleware/length_cutoff.rb
tracksperanto-1.8.0 lib/middleware/length_cutoff.rb
tracksperanto-1.7.5 lib/middleware/length_cutoff.rb
tracksperanto-1.7.4 lib/middleware/length_cutoff.rb