tracksperanto 3.3.11 → 3.3.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/History.txt CHANGED
@@ -1,3 +1,7 @@
1
+ === 3.3.12
2
+
3
+ * Fix the bug in MatchMover imports that caused the import to fail if the file contained a multiline path
4
+
1
5
  === 3.3.11
2
6
 
3
7
  * Fix the bug that caused CLI short flags to be ignored
@@ -26,9 +26,24 @@ class Tracksperanto::Import::MatchMover < Tracksperanto::Import::Base
26
26
  last_line = lines[-1]
27
27
  int_groups = last_line.scan(/(\d+)/).flatten.map{|e| e.to_i }
28
28
  @width, @height = int_groups.shift, int_groups.shift
29
+ unless @width && @height
30
+ raise "Cannot detect the dimensions of the comp from the file"
31
+ end
32
+
29
33
  # Next the starting frame of the sequence. The preamble ends with the p(0 293 1)
30
- # which is p( first_frame length framestep )
31
- @first_frame_of_sequence, length, frame_step = int_groups[-3], int_groups[-2], int_groups[-1]
34
+ # which is p( first_frame length framestep ). Some files export the path to the sequence
35
+ # as multiline, so we will need to succesively scan until we find our line that contains the dimensions
36
+ frame_steps_re = /b\( (\d+) (\d+) (\d+) \)/ # b( 0 293 1 )
37
+ until @first_frame_of_sequence
38
+ digit_groups = last_line.scan(frame_steps_re).flatten
39
+ if digit_groups.any?
40
+ @first_frame_of_sequence, length, frame_step = digit_groups.map{|e| e.to_i }
41
+ return
42
+ end
43
+ last_line = io.gets
44
+ end
45
+
46
+ raise "Cannot detect the start frame of the sequence"
32
47
  end
33
48
 
34
49
  def extract_trackers(io)
data/lib/tracksperanto.rb CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  module Tracksperanto
5
5
  PATH = File.expand_path(File.dirname(__FILE__))
6
- VERSION = '3.3.11'
6
+ VERSION = '3.3.12'
7
7
 
8
8
  module Import; end
9
9
  module Export; end
@@ -7,6 +7,7 @@ class MatchMoverImportTest < Test::Unit::TestCase
7
7
  P = File.dirname(__FILE__) + '/samples/match_mover/kipPointsMatchmover.rz2'
8
8
  P2 = File.dirname(__FILE__) + '/samples/match_mover/NonSequentialMatchmoverPoints.rz2'
9
9
  P3 = File.dirname(__FILE__) + '/samples/match_mover/cha_171_1020_atb_v001.rz2'
10
+ P4 = File.dirname(__FILE__) + '/samples/match_mover/2dtracks.rz2'
10
11
 
11
12
  def test_introspects_properly
12
13
  i = Tracksperanto::Import::MatchMover
@@ -59,4 +60,25 @@ class MatchMoverImportTest < Test::Unit::TestCase
59
60
  assert_in_delta 0.027457, last_kf.residual, DELTA
60
61
  end
61
62
 
63
+ def test_parsing_from_matchmover_with_multiline_sequence_path
64
+ fixture = File.open(P4)
65
+
66
+ parser = Tracksperanto::Import::MatchMover.new(:io => fixture)
67
+ trackers = parser.to_a
68
+
69
+ assert_equal 2156, parser.width
70
+ assert_equal 1804, parser.height
71
+
72
+ assert_equal 18, trackers.length
73
+
74
+ first_t = trackers[0]
75
+ assert_equal "Track_01", first_t.name
76
+ assert_equal 137, first_t.length
77
+ first_kf = first_t[0]
78
+
79
+ assert_equal 119, first_kf.frame
80
+ assert_in_delta 10.715, first_kf.abs_x, DELTA
81
+ assert_in_delta 461.36, first_kf.abs_y, DELTA
82
+ assert_in_delta 0.2, first_kf.residual, DELTA
83
+ end
62
84
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "tracksperanto"
8
- s.version = "3.3.11"
8
+ s.version = "3.3.12"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Julik Tarkhanov"]
12
- s.date = "2013-10-08"
12
+ s.date = "2013-11-07"
13
13
  s.description = "Converts 2D track exports between different apps like Flame, MatchMover, PFTrack..."
14
14
  s.email = "me@julik.nl"
15
15
  s.executables = ["tracksperanto"]
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: 3.3.11
4
+ version: 3.3.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-08 00:00:00.000000000 Z
12
+ date: 2013-11-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -456,7 +456,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
456
456
  version: '0'
457
457
  segments:
458
458
  - 0
459
- hash: -1946567942053195815
459
+ hash: -3669593721904683814
460
460
  required_rubygems_version: !ruby/object:Gem::Requirement
461
461
  none: false
462
462
  requirements: