Class: Tracksperanto::Tool::LengthCutoff

Inherits:
Base
  • Object
show all
Defined in:
lib/tools/length_cutoff.rb

Overview

This tool removes trackers that contain less than min_length keyframes from the exported batch

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

inherited, #initialize

Methods included from Parameters

#parameter, #parameters

Methods included from SimpleExport

#just_export

Methods included from ConstName

#const_name

Methods included from BlockInit

#initialize

Methods included from Casts

#cast_to_bool, #cast_to_float, #cast_to_int, #cast_to_string

Constructor Details

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

Class Method Details

.action_descriptionObject



7
8
9
# File 'lib/tools/length_cutoff.rb', line 7

def self.action_description
  "Remove trackers that have less than the specified number of keyframes"
end

Instance Method Details

#end_tracker_segmentObject



15
16
17
18
19
20
21
# File 'lib/tools/length_cutoff.rb', line 15

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

#export_point(frame, float_x, float_y, float_residual) ⇒ Object



23
24
25
# File 'lib/tools/length_cutoff.rb', line 23

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

#start_tracker_segment(name) ⇒ Object



11
12
13
# File 'lib/tools/length_cutoff.rb', line 11

def start_tracker_segment(name)
  @tracker = Tracksperanto::Tracker.new(:name => name)
end