tracksperanto 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 1.2.2 / 2009-09-21
2
+
3
+ * Support both PFTrack 4 and 5
4
+
1
5
  === 1.2.1 / 2009-09-21
2
6
 
3
7
  * Fixed the binary that was not able to properly pass the importer class to the pipeline
@@ -1,14 +1,14 @@
1
1
  # Export for PFTrack .2dt files
2
- class Tracksperanto::Export::PFTrack < Tracksperanto::Export::Base
2
+ class Tracksperanto::Export::PFTrack4 < Tracksperanto::Export::Base
3
3
 
4
4
  KEYFRAME_TEMPLATE = "%s %.3f %.3f %.3f"
5
5
 
6
6
  def self.desc_and_extension
7
- "pftrack.2dt"
7
+ "pftrack_v4.2dt"
8
8
  end
9
9
 
10
10
  def self.human_name
11
- "PFTrack .2dt file"
11
+ "PFTrack v4 .2dt file"
12
12
  end
13
13
 
14
14
  def start_tracker_segment(tracker_name)
@@ -7,13 +7,15 @@ class Tracksperanto::Import::PFTrack < Tracksperanto::Import::Base
7
7
  ".2dt"
8
8
  end
9
9
 
10
+ CHARACTERS = /[AZaz]/
11
+
10
12
  def parse(io)
11
13
  trackers = []
12
14
  until io.eof?
13
15
  line = io.gets
14
- next unless line
16
+ next if (!line || line =~ /^#/)
15
17
 
16
- if line =~ /[AZaz]/ # Tracker with a name
18
+ if line =~ CHARACTERS # Tracker with a name
17
19
  t = Tracksperanto::Tracker.new{|t| t.name = line.strip.gsub(/"/, '') }
18
20
  report_progress("Reading tracker #{t.name}")
19
21
  parse_tracker(t, io)
@@ -26,7 +28,13 @@ class Tracksperanto::Import::PFTrack < Tracksperanto::Import::Base
26
28
 
27
29
  private
28
30
  def parse_tracker(t, io)
29
- num_of_keyframes = io.gets.chomp.to_i
31
+ first_tracker_line = io.gets.chomp
32
+
33
+ if first_tracker_line =~ CHARACTERS # PFTrack version 5 format
34
+ first_tracker_line = io.gets.chomp
35
+ end
36
+
37
+ num_of_keyframes = first_tracker_line.to_i
30
38
  t.keyframes = (1..num_of_keyframes).map do
31
39
  report_progress("Reading keyframe")
32
40
  Tracksperanto::Keyframe.new do |k|
data/lib/pipeline/base.rb CHANGED
@@ -64,7 +64,6 @@ class Tracksperanto::Pipeline::Base
64
64
  end
65
65
 
66
66
  def detect_importer_or_use_options(path, opts)
67
- puts opts[:parser].inspect
68
67
  d = Tracksperanto::FormatDetector.new(path)
69
68
  if d.match? && d.auto_size?
70
69
  return [1, 1, d.importer_klass]
data/lib/tracksperanto.rb CHANGED
@@ -4,7 +4,7 @@ require 'delegate'
4
4
 
5
5
  module Tracksperanto
6
6
  PATH = File.expand_path(File.dirname(__FILE__))
7
- VERSION = '1.2.1'
7
+ VERSION = '1.2.2'
8
8
 
9
9
  module Import; end
10
10
  module Export; end
@@ -0,0 +1,19 @@
1
+ require File.dirname(__FILE__) + '/../helper'
2
+
3
+ class PFTrack5ExportTest < Test::Unit::TestCase
4
+ include ParabolicTracks
5
+
6
+ def test_human_name
7
+ assert_equal "PFTrack v5 .2dt file", Tracksperanto::Export::PFTrack5.human_name
8
+ end
9
+
10
+ def test_desc_and_ext
11
+ assert_equal "pftrack_v5.2dt", Tracksperanto::Export::PFTrack5.desc_and_extension
12
+ end
13
+
14
+ P = File.dirname(__FILE__) + "/samples/ref_PFTrack5.2dt"
15
+
16
+ def test_export_output_written
17
+ create_reference_output Tracksperanto::Export::PFTrack5, P
18
+ end
19
+ end
@@ -4,16 +4,16 @@ class PFTrackExportTest < Test::Unit::TestCase
4
4
  include ParabolicTracks
5
5
 
6
6
  def test_human_name
7
- assert_equal "PFTrack .2dt file", Tracksperanto::Export::PFTrack.human_name
7
+ assert_equal "PFTrack v4 .2dt file", Tracksperanto::Export::PFTrack4.human_name
8
8
  end
9
9
 
10
10
  def test_desc_and_ext
11
- assert_equal "pftrack.2dt", Tracksperanto::Export::PFTrack.desc_and_extension
11
+ assert_equal "pftrack_v4.2dt", Tracksperanto::Export::PFTrack4.desc_and_extension
12
12
  end
13
13
 
14
14
  P = File.dirname(__FILE__) + "/samples/ref_PFTrack.2dt"
15
15
 
16
16
  def test_export_output_written
17
- ensure_same_output Tracksperanto::Export::PFTrack, P
17
+ ensure_same_output Tracksperanto::Export::PFTrack4, P
18
18
  end
19
19
  end
@@ -36,4 +36,13 @@ class PFTrackImportTest < Test::Unit::TestCase
36
36
  assert_equal "Tracker41", trackers[-1].name
37
37
  assert_equal 467, trackers[-1].keyframes.length
38
38
  end
39
+
40
+ def test_garage_shot
41
+ fixture = File.open(File.dirname(__FILE__) + '/samples/garage.2dt')
42
+ parser = Tracksperanto::Import::PFTrack.new(:width => 1920, :height => 1080)
43
+ trackers = parser.parse(fixture)
44
+ assert_equal 250, trackers.length
45
+ assert_equal "Tracker121", trackers[0].name
46
+ assert_equal 189, trackers[0].length
47
+ end
39
48
  end
@@ -27,19 +27,4 @@ class SyntheyesImportTest < Test::Unit::TestCase
27
27
  assert_in_delta 886.212, first_kf.abs_y, DELTA
28
28
  assert_in_delta 30.0, first_kf.residual, DELTA
29
29
  end
30
-
31
- def test_syntheyes_import_from_victorw
32
- fixture = File.open(File.dirname(__FILE__) + "/samples/testalltrackers_VictorW.txt")
33
- parser = Tracksperanto::Import::Syntheyes.new
34
- parser.width = 1920
35
- parser.height = 1080
36
-
37
- trackers = parser.parse(fixture)
38
- for tracker in trackers
39
- puts tracker.inspect
40
- STDOUT.flush
41
- end
42
-
43
- end
44
-
45
30
  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.2.1
4
+ version: 1.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julik Tarkhanov
@@ -168,6 +168,7 @@ test_files:
168
168
  - test/export/test_match_mover_export.rb
169
169
  - test/export/test_mux.rb
170
170
  - test/export/test_nuke_export.rb
171
+ - test/export/test_pftrack5_export.rb
171
172
  - test/export/test_pftrack_export.rb
172
173
  - test/export/test_shake_export.rb
173
174
  - test/export/test_syntheyes_export.rb