tracksperanto 1.6.0 → 1.6.1

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 1.6.1 / 2009-11-15
2
+
3
+ * Fixes the Reformat middleware to not suppress the end_export call. Crucial for exporters that
4
+ use end_export to finalize output
5
+
1
6
  === 1.6.0 / 2009-11-15
2
7
 
3
8
  * MatchMover has top-left coordinates - fixed for both import and export
@@ -14,31 +14,26 @@ class Tracksperanto::Export::Equalizer3 < Tracksperanto::Export::Base
14
14
  def start_export( img_width, img_height)
15
15
  @w, @h = img_width, img_height
16
16
  # 3DE needs to know the number of keyframes in advance
17
- @internal_io, @highest_keyframe = Tempfile.new("Tracksperanto_3de"), 0
17
+ @buffer = Tempfile.new("ts3dex")
18
+ @highest_keyframe = 0
18
19
  end
19
20
 
20
21
  def start_tracker_segment(tracker_name)
21
- @internal_io.puts(tracker_name)
22
+ @buffer.puts(tracker_name)
22
23
  end
23
24
 
24
25
  def export_point(frame, abs_float_x, abs_float_y, float_residual)
25
26
  off_by_one = frame + 1
26
- @internal_io.puts("\t%d\t%.3f\t%.3f" % [off_by_one, abs_float_x, abs_float_y])
27
+ @buffer.puts("\t%d\t%.3f\t%.3f" % [off_by_one, abs_float_x, abs_float_y])
27
28
  @highest_keyframe = off_by_one if (@highest_keyframe < off_by_one)
28
29
  end
29
30
 
30
31
  def end_export
32
+ @buffer.rewind
31
33
  preamble = HEADER.gsub(/2048/, @w.to_s).gsub(/778/, @h.to_s).gsub(/275/, @highest_keyframe.to_s)
32
34
  @io.puts(preamble)
33
- @internal_io.rewind
34
- @io.puts(@internal_io.read)
35
- discard_io
35
+ @io.puts(@buffer.read) until @buffer.eof?
36
+ @buffer.close!
36
37
  @io.puts("") # Newline at end
37
38
  end
38
-
39
- private
40
- def discard_io
41
- @internal_io.close
42
- @internal_io = nil
43
- end
44
39
  end
@@ -43,7 +43,6 @@ class Tracksperanto::Export::Equalizer4 < Tracksperanto::Export::Base
43
43
 
44
44
  private
45
45
  def discard_io
46
- @internal_io.close
47
- @internal_io = nil
46
+ @internal_io.close!
48
47
  end
49
48
  end
@@ -1,5 +1,6 @@
1
1
  # Export for Syntheyes tracker UVs
2
2
  class Tracksperanto::Export::SynthEyes < Tracksperanto::Export::Base
3
+ include Tracksperanto::UVCoordinates
3
4
 
4
5
  def self.desc_and_extension
5
6
  "syntheyes_2dt.txt"
@@ -18,18 +19,7 @@ class Tracksperanto::Export::SynthEyes < Tracksperanto::Export::Base
18
19
  end
19
20
 
20
21
  def export_point(frame, abs_float_x, abs_float_y, float_residual)
21
- values = [@tracker_name, frame] + syntheyes_coords(abs_float_x, abs_float_y, @width, @height)
22
+ values = [@tracker_name, frame] + absolute_to_uv(abs_float_x, abs_float_y, @width, @height)
22
23
  @io.puts("%s %d %.6f %.6f 30" % values)
23
24
  end
24
-
25
- private
26
-
27
- # Syntheyes wants very special coordinates, Y down X right,
28
- # 0 is center and values are UV float -1 to 1, doubled
29
- def syntheyes_coords(abs_x, abs_y, w, h)
30
- x = (abs_x / w.to_f) - 0.5
31
- y = (abs_y / h.to_f) - 0.5
32
- # .2 to -.3, y is reversed and coords are double
33
- [x * 2, y * -2]
34
- end
35
25
  end
@@ -1,4 +1,5 @@
1
1
  class Tracksperanto::Import::Syntheyes < Tracksperanto::Import::Base
2
+ include Tracksperanto::UVCoordinates
2
3
 
3
4
  def self.human_name
4
5
  "Syntheyes 2D tracker paths file"
@@ -28,13 +29,5 @@ class Tracksperanto::Import::Syntheyes < Tracksperanto::Import::Base
28
29
 
29
30
  trackers
30
31
  end
31
-
32
- private
33
- # Syntheyes exports UV coordinates that go from -1 to 1, up and right and 0
34
- # is the center
35
- def convert_from_uv(absolute_side, uv_value)
36
- # First, start from zero (-.1 becomes .4)
37
- value_off_corner = (uv_value.to_f / 2) + 0.5
38
- absolute_side * value_off_corner
39
- end
32
+
40
33
  end
@@ -22,5 +22,6 @@ class Tracksperanto::Middleware::Reformat < Tracksperanto::Middleware::Base
22
22
 
23
23
  def end_export
24
24
  @exporter = @stash
25
+ @exporter.end_export
25
26
  end
26
27
  end
data/lib/pipeline/base.rb CHANGED
@@ -162,7 +162,7 @@ class Tracksperanto::Pipeline::Base
162
162
 
163
163
  # Check that the trackers made by the parser are A-OK
164
164
  def validate_trackers!(trackers)
165
- raise "Could not recover any trackers from this file. Wrong import format maybe?" if trackers.empty?
166
- trackers.reject!{|t| t.empty? }
165
+ trackers.reject!{|t| t.length < 2 }
166
+ raise "Could not recover any non-empty trackers from this file. Wrong import format maybe?" if trackers.empty?
167
167
  end
168
168
  end
data/lib/tracksperanto.rb CHANGED
@@ -4,7 +4,7 @@ require 'tempfile'
4
4
 
5
5
  module Tracksperanto
6
6
  PATH = File.expand_path(File.dirname(__FILE__))
7
- VERSION = '1.6.0'
7
+ VERSION = '1.6.1'
8
8
 
9
9
  module Import; end
10
10
  module Export; end
@@ -42,7 +42,19 @@ module Tracksperanto
42
42
 
43
43
  end
44
44
 
45
- %w( const_name casts block_init safety zip_tuples keyframe tracker format_detector ext_io simple_export).each do | submodule |
45
+ %w(
46
+ const_name
47
+ casts
48
+ block_init
49
+ safety
50
+ zip_tuples
51
+ keyframe
52
+ tracker
53
+ format_detector
54
+ ext_io
55
+ simple_export
56
+ uv_coordinates
57
+ ).each do | submodule |
46
58
  require File.join(Tracksperanto::PATH, "tracksperanto", submodule)
47
59
  end
48
60
 
@@ -25,9 +25,11 @@ class ReformatMiddlewareTest < Test::Unit::TestCase
25
25
 
26
26
  receiver = flexmock
27
27
  receiver.should_receive(:start_export).once.with(1920,1080)
28
+ receiver.should_receive(:end_export).once
28
29
 
29
30
  m = Tracksperanto::Middleware::Reformat.new(receiver, :width => 1920, :height => 1080)
30
31
 
31
32
  m.start_export(720, 576)
33
+ m.end_export
32
34
  end
33
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tracksperanto
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-16 00:00:00 +01:00
12
+ date: 2009-11-23 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency