lib/import/shake_script.rb in tracksperanto-1.6.2 vs lib/import/shake_script.rb in tracksperanto-1.6.3
- old
+ new
@@ -28,11 +28,13 @@
keyframes.map do | kf |
[kf[1][1], kf[0][1]]
end
end
alias_method :nspline, :linear
+ alias_method :jspline, :linear
+
# image Tracker(
# image In,
# const char * trackRange,
# const char * subPixelRes,
# const char * matchSpace,
@@ -199,17 +201,25 @@
return
end
report_progress("Scavenging tracker #{name}")
- keyframes = zip_curve_tuples(x_curve, y_curve, corr_curve).map do | (frame, x, y, corr) |
- Tracksperanto::Keyframe.new(:frame => frame - 1, :abs_x => x, :abs_y => y, :residual => (1 - corr))
+ curve_set = combine_curves(x_curve, y_curve, corr_curve)
+
+ keyframes = zip_curve_tuples(*curve_set).map do | (frame, x, y, corr) |
+ Tracksperanto::Keyframe.new(:frame => frame - 1, :abs_x => x, :abs_y => y, :residual => (1 - corr.to_f))
end
t = Tracksperanto::Tracker.new(:name => name, :keyframes => keyframes )
self.class.accumulator.push(t)
end
+
+ def combine_curves(x, y, corr_curve)
+ curve_set = [x, y]
+ curve_set << corr_curve if (corr_curve.respond_to?(:length) && corr_curve.length >= x.length)
+ curve_set
+ end
end
def parse(script_io)
trackers = []
@@ -217,6 +227,7 @@
Traxtractor.progress_block = lambda{|msg| report_progress(msg) }
Traxtractor.new(script_io)
trackers
end
+
end
\ No newline at end of file