tracksperanto 2.12.0 → 3.0.0
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/DEVELOPER_DOCS.rdoc +15 -8
- data/History.txt +21 -14
- data/Rakefile +1 -0
- data/bin/tracksperanto +30 -29
- data/lib/export/flame_stabilizer_cornerpin.rb +4 -2
- data/lib/export/pfmatchit.rb +8 -1
- data/lib/export/pftrack.rb +8 -1
- data/lib/import/pftrack.rb +4 -1
- data/lib/import/syntheyes.rb +2 -2
- data/lib/pipeline/base.rb +13 -13
- data/lib/{middleware → tools}/base.rb +7 -7
- data/lib/{middleware → tools}/crop.rb +3 -3
- data/lib/{middleware → tools}/flip.rb +2 -2
- data/lib/{middleware → tools}/flop.rb +2 -2
- data/lib/{middleware → tools}/golden.rb +2 -2
- data/lib/{middleware → tools}/length_cutoff.rb +2 -2
- data/lib/{middleware → tools}/lens_disto.rb +2 -2
- data/lib/{middleware → tools}/lerp.rb +2 -2
- data/lib/{middleware → tools}/lint.rb +1 -1
- data/lib/{middleware → tools}/move_to_first.rb +3 -3
- data/lib/{middleware → tools}/pad.rb +2 -2
- data/lib/{middleware → tools}/prefix.rb +2 -2
- data/lib/{middleware → tools}/reformat.rb +3 -3
- data/lib/{middleware → tools}/scaler.rb +1 -1
- data/lib/{middleware → tools}/shift.rb +2 -2
- data/lib/{middleware → tools}/slipper.rb +1 -1
- data/lib/tools/start_trim.rb +17 -0
- data/lib/tracksperanto/pf_coords.rb +9 -0
- data/lib/tracksperanto/simple_export.rb +1 -1
- data/lib/tracksperanto/uv_coordinates.rb +15 -13
- data/lib/tracksperanto.rb +16 -15
- data/test/export/samples/ref_PFMatchit.2dt +39 -39
- data/test/export/samples/ref_PFTrack.2dt +39 -39
- data/test/export/samples/ref_PFTrack5.2dt +39 -39
- data/test/export/samples/ref_Syntheyes.txt +39 -39
- data/test/import/test_pftrack_import.rb +5 -5
- data/test/import/test_shake_script_import.rb +9 -1
- data/test/import/test_syntheyes_import.rb +3 -3
- data/test/subpixel/Flame_Smk2013_SubpixSample.stabilizer +310 -0
- data/test/subpixel/julik_pftrack.txt +14 -0
- data/test/subpixel/shake_subpix_v01.shk +308 -0
- data/test/subpixel/subpix_import_test.rb +75 -0
- data/test/subpixel/subpixel_grid.ifl +1 -0
- data/test/subpixel/subpixel_grid.sni +0 -0
- data/test/subpixel/subpixel_grid.tif +0 -0
- data/test/subpixel/sy_subpix_2dpaths.txt +4 -0
- data/test/test_const_name.rb +2 -2
- data/test/test_pipeline.rb +10 -10
- data/test/test_tracksperanto.rb +11 -11
- data/test/test_uv_coords.rb +29 -0
- data/test/{middleware → tools}/test_crop_middleware.rb +4 -4
- data/test/{middleware → tools}/test_flip_middleware.rb +3 -3
- data/test/{middleware → tools}/test_flop_middleware.rb +3 -3
- data/test/{middleware → tools}/test_golden_middleware.rb +3 -3
- data/test/{middleware → tools}/test_length_cutoff_middleware.rb +5 -5
- data/test/{middleware → tools}/test_lens_middleware.rb +9 -9
- data/test/{middleware → tools}/test_lerp_middleware.rb +3 -3
- data/test/{middleware → tools}/test_lint_middleware.rb +11 -11
- data/test/{middleware → tools}/test_move_to_first_frame_middleware.rb +3 -3
- data/test/{middleware → tools}/test_pad_middleware.rb +4 -4
- data/test/{middleware → tools}/test_prefix.rb +5 -5
- data/test/{middleware → tools}/test_reformat_middleware.rb +5 -5
- data/test/{middleware → tools}/test_scaler_middleware.rb +7 -7
- data/test/{middleware → tools}/test_shift_middleware.rb +4 -4
- data/test/{middleware → tools}/test_slip_middleware.rb +5 -5
- data/test/{middleware → tools}/test_start_trim_middleware.rb +3 -3
- data/tracksperanto.gemspec +45 -35
- metadata +46 -36
- data/lib/middleware/start_trim.rb +0 -17
@@ -0,0 +1,75 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
3
|
+
|
4
|
+
class SubpixelImportTest < Test::Unit::TestCase
|
5
|
+
DELTA = 0.1
|
6
|
+
|
7
|
+
# We know that the following apps use the edge of the pixel raster as 0:
|
8
|
+
# Shake, Flame, 3DE.
|
9
|
+
|
10
|
+
# In Syntheyes, the coordinates of the corners are effectively at the center of the pixels of the grid.
|
11
|
+
# WE NEED to make adjustments to the Syntheyes workflows to account for "on-pixel" coordinates as opposed to "pixel corner"
|
12
|
+
def test_parsing_from_syntheyes_2dp
|
13
|
+
fixture = File.open(File.dirname(__FILE__) + '/sy_subpix_2dpaths.txt')
|
14
|
+
trackers = Tracksperanto::Import::Syntheyes.new(:io => fixture, :width => 720, :height => 576).to_a
|
15
|
+
|
16
|
+
bl_kf = trackers[2][0]
|
17
|
+
assert_in_delta 0.0, bl_kf.abs_x, DELTA
|
18
|
+
assert_in_delta 0.0, bl_kf.abs_y, DELTA
|
19
|
+
|
20
|
+
tr_kf = trackers[3][0]
|
21
|
+
assert_in_delta 720.0, tr_kf.abs_x, DELTA
|
22
|
+
assert_in_delta 576.0, tr_kf.abs_y, DELTA
|
23
|
+
end
|
24
|
+
|
25
|
+
# In PFTrack the coordinates are shifted by .5 pixels and the 0 coordinate is not at the edge of the pixel raster,
|
26
|
+
# but in the middle of the leftmost bottom pixel.
|
27
|
+
def test_parsing_from_pftrack
|
28
|
+
fixture = File.open(File.dirname(__FILE__) + '/julik_pftrack.txt')
|
29
|
+
trackers = Tracksperanto::Import::PFTrack.new(:io => fixture, :width => 720, :height => 576).to_a
|
30
|
+
|
31
|
+
bl_kf = trackers[0][0]
|
32
|
+
assert_in_delta 0.5, bl_kf.abs_x, DELTA
|
33
|
+
assert_in_delta 0.5, bl_kf.abs_y, DELTA
|
34
|
+
|
35
|
+
tr_kf = trackers[1][0]
|
36
|
+
assert_in_delta 715.5, tr_kf.abs_x, DELTA
|
37
|
+
assert_in_delta 571.514, tr_kf.abs_y, DELTA
|
38
|
+
end
|
39
|
+
|
40
|
+
# Subpixel accuracy is native in Shake.
|
41
|
+
# It is therefore IN LINE with the Tracksperanto spec.
|
42
|
+
def test_parsing_from_shake_script
|
43
|
+
fixture = File.open(File.dirname(__FILE__) + '/shake_subpix_v01.shk')
|
44
|
+
|
45
|
+
trackers = Tracksperanto::Import::ShakeScript.new(:io => fixture, :width => 720, :height => 576).to_a
|
46
|
+
assert_equal 2, trackers.length
|
47
|
+
|
48
|
+
bl_kf = trackers[0][0]
|
49
|
+
assert_in_delta 0.5, bl_kf.abs_x, DELTA
|
50
|
+
assert_in_delta 0.5, bl_kf.abs_y, DELTA
|
51
|
+
|
52
|
+
tr_kf = trackers[1][0]
|
53
|
+
assert_in_delta 715.5, tr_kf.abs_x, DELTA
|
54
|
+
assert_in_delta 571.514, tr_kf.abs_y, DELTA
|
55
|
+
end
|
56
|
+
|
57
|
+
# Flame DOES allow subpix references, however in Action the coordinates of the first tracked keyframe
|
58
|
+
# will be nudged to whole pixels. Which is shit. However we care about the stabilizer data, not about
|
59
|
+
# how it gets applied.
|
60
|
+
# Subpixel handling in Flame is therefore IN LINE with the Tracksperanto spec.
|
61
|
+
def test_from_flame_setup
|
62
|
+
fixture = File.open(File.dirname(__FILE__) + '/Flame_Smk2013_SubpixSample.stabilizer')
|
63
|
+
t = Tracksperanto::Import::FlameStabilizer.new(:io => fixture).to_a[0]
|
64
|
+
first_kf = t[0]
|
65
|
+
assert_in_delta 0.5, first_kf.abs_x, DELTA
|
66
|
+
assert_in_delta 0.5, first_kf.abs_y, DELTA
|
67
|
+
end
|
68
|
+
|
69
|
+
# Nuke properly computes coordinates off the corner.
|
70
|
+
# def test_from_nuke_script
|
71
|
+
# fixture = File.open(File.dirname(__FILE__) + '/julik_nuke.nk')
|
72
|
+
# t = Tracksperanto::Import::NukeScript.new(:width => 720, :height => 576, :io => fixture).to_a
|
73
|
+
# assert_equal 1, t.length, "Should have imported one tracker"
|
74
|
+
# end
|
75
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
/Users/julik/Code/apps/tracksperanto/test/subpixel/subpixel_grid.tif
|
Binary file
|
Binary file
|
data/test/test_const_name.rb
CHANGED
@@ -4,8 +4,8 @@ require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
|
4
4
|
class TestConstName < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_const_name
|
7
|
-
assert_equal "Scaler", Tracksperanto::
|
8
|
-
assert_equal "Scaler", Tracksperanto::
|
7
|
+
assert_equal "Scaler", Tracksperanto::Tool::Scaler.const_name
|
8
|
+
assert_equal "Scaler", Tracksperanto::Tool::Scaler.new(nil).const_name
|
9
9
|
assert_equal "ShakeScript", Tracksperanto::Import::ShakeScript.const_name
|
10
10
|
assert_equal "ShakeText", Tracksperanto::Export::ShakeText.const_name
|
11
11
|
end
|
data/test/test_pipeline.rb
CHANGED
@@ -32,8 +32,8 @@ class TestPipeline < Test::Unit::TestCase
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def test_supports_block_init
|
35
|
-
pipeline = Tracksperanto::Pipeline::Base.new(:
|
36
|
-
assert_equal [:a, :b], pipeline.
|
35
|
+
pipeline = Tracksperanto::Pipeline::Base.new(:tool_tuples => [:a, :b])
|
36
|
+
assert_equal [:a, :b], pipeline.tool_tuples
|
37
37
|
end
|
38
38
|
|
39
39
|
def test_run_with_autodetected_importer_and_size_without_progress_block
|
@@ -87,24 +87,24 @@ class TestPipeline < Test::Unit::TestCase
|
|
87
87
|
assert_raise(Tracksperanto::Pipeline::NoTrackersRecoveredError) { pipeline.run(empty_file_path) }
|
88
88
|
end
|
89
89
|
|
90
|
-
def
|
90
|
+
def test_tool_initialization_from_tuples
|
91
91
|
create_stabilizer_file
|
92
92
|
|
93
93
|
pipeline = Tracksperanto::Pipeline::Base.new
|
94
|
-
pipeline.
|
94
|
+
pipeline.tool_tuples = [
|
95
95
|
["Bla", {:foo=> 234}]
|
96
96
|
]
|
97
97
|
|
98
98
|
mock_mux = flexmock("MUX")
|
99
99
|
mock_lint = flexmock("LINT")
|
100
100
|
flexmock(Tracksperanto::Export::Mux).should_receive(:new).and_return(mock_mux)
|
101
|
-
flexmock(Tracksperanto::
|
101
|
+
flexmock(Tracksperanto::Tool::Lint).should_receive(:new).with(mock_mux).and_return(mock_lint)
|
102
102
|
|
103
|
-
m = flexmock("
|
104
|
-
|
103
|
+
m = flexmock("tool object")
|
104
|
+
mock_tool_class = flexmock("tool class")
|
105
105
|
|
106
|
-
flexmock(Tracksperanto).should_receive(:
|
107
|
-
|
106
|
+
flexmock(Tracksperanto).should_receive(:get_tool).with("Bla").once.and_return(mock_tool_class)
|
107
|
+
mock_tool_class.should_receive(:new).with(mock_lint, {:foo => 234}).once
|
108
108
|
|
109
109
|
assert_raise(NoMethodError) { pipeline.run(@stabilizer) }
|
110
110
|
end
|
@@ -146,7 +146,7 @@ class TestPipeline < Test::Unit::TestCase
|
|
146
146
|
|
147
147
|
def test_importing_file_with_trackers_of_zero_length_does_not_accumulate_any_trackers
|
148
148
|
pft_with_empty_trackers = "./import/samples/pftrack5/empty_trackers.2dt"
|
149
|
-
i = Tracksperanto::Import::PFTrack.new(:io => File.open(pft_with_empty_trackers))
|
149
|
+
i = Tracksperanto::Import::PFTrack.new(:io => File.open(pft_with_empty_trackers), :width => 1920, :height => 1080)
|
150
150
|
tks = i.to_a
|
151
151
|
assert_equal 3, tks.length
|
152
152
|
assert_equal 0, tks[0].length, "The tracker should have 0 keyframes for this test to make sense"
|
data/test/test_tracksperanto.rb
CHANGED
@@ -2,10 +2,10 @@
|
|
2
2
|
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
3
3
|
|
4
4
|
class TracksperantoTest < Test::Unit::TestCase
|
5
|
-
def
|
6
|
-
m = Tracksperanto.
|
7
|
-
m.each do |
|
8
|
-
assert_kind_of Module,
|
5
|
+
def test_tools
|
6
|
+
m = Tracksperanto.tools
|
7
|
+
m.each do | tool_module |
|
8
|
+
assert_kind_of Module, tool_module
|
9
9
|
end
|
10
10
|
end
|
11
11
|
|
@@ -33,8 +33,8 @@ class TracksperantoTest < Test::Unit::TestCase
|
|
33
33
|
assert_equal m.sort, m
|
34
34
|
end
|
35
35
|
|
36
|
-
def
|
37
|
-
m = Tracksperanto.
|
36
|
+
def test_tool_names
|
37
|
+
m = Tracksperanto.tool_names
|
38
38
|
assert m.include?("Golden")
|
39
39
|
end
|
40
40
|
|
@@ -53,9 +53,9 @@ class TracksperantoTest < Test::Unit::TestCase
|
|
53
53
|
assert_equal i1, Tracksperanto::Import::Syntheyes
|
54
54
|
end
|
55
55
|
|
56
|
-
def
|
57
|
-
i1 = Tracksperanto.
|
58
|
-
assert_equal i1, Tracksperanto::
|
56
|
+
def test_get_tool
|
57
|
+
i1 = Tracksperanto.get_tool("lERP")
|
58
|
+
assert_equal i1, Tracksperanto::Tool::Lerp
|
59
59
|
end
|
60
60
|
|
61
61
|
def test_get_importer_multicase
|
@@ -82,8 +82,8 @@ class TracksperantoTest < Test::Unit::TestCase
|
|
82
82
|
assert_raise(Tracksperanto::UnknownImporterError) { Tracksperanto.get_importer("foo") }
|
83
83
|
end
|
84
84
|
|
85
|
-
def
|
86
|
-
assert_raise(Tracksperanto::
|
85
|
+
def test_get_unknown_tool_should_raise
|
86
|
+
assert_raise(Tracksperanto::UnknownToolError) { Tracksperanto.get_tool("foo") }
|
87
87
|
end
|
88
88
|
|
89
89
|
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require File.expand_path(File.dirname(__FILE__)) + '/helper'
|
3
|
+
|
4
|
+
class TestUVCoords < Test::Unit::TestCase
|
5
|
+
include Tracksperanto::UVCoordinates
|
6
|
+
|
7
|
+
DELTA = 0.001
|
8
|
+
|
9
|
+
def test_from_uv
|
10
|
+
assert_in_delta 719.5, convert_from_uv(1.0, 720), DELTA
|
11
|
+
assert_in_delta 0.5, convert_from_uv(-1.0, 720), DELTA
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_from_uv_with_small_values
|
15
|
+
assert_in_delta 0.5, convert_from_uv(-1.0, 16), DELTA
|
16
|
+
assert_in_delta 15.5, convert_from_uv(1.0, 16), DELTA
|
17
|
+
end
|
18
|
+
|
19
|
+
def test_to_uv_with_small_values
|
20
|
+
assert_in_delta -1.0, convert_to_uv(0.5, 16), DELTA
|
21
|
+
assert_in_delta 1.0, convert_to_uv(15.5, 16), DELTA
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
def test_to_uv
|
26
|
+
assert_in_delta 1.0, convert_to_uv(719.5, 720), DELTA
|
27
|
+
assert_in_delta -1.0, convert_to_uv(0.5, 720), DELTA
|
28
|
+
end
|
29
|
+
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
3
3
|
|
4
|
-
class
|
4
|
+
class CropToolTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_action_description
|
7
|
-
assert_equal "Crop or pad the image by a specified number of pixels", Tracksperanto::
|
7
|
+
assert_equal "Crop or pad the image by a specified number of pixels", Tracksperanto::Tool::Crop.action_description
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_crop_supports_hash_init
|
11
11
|
receiver = flexmock
|
12
|
-
m = Tracksperanto::
|
12
|
+
m = Tracksperanto::Tool::Crop.new(receiver, :left => 13, :right => 0, :top => 25)
|
13
13
|
end
|
14
14
|
|
15
15
|
def test_shift_bypasses_methods
|
@@ -22,7 +22,7 @@ class CropMiddlewareTest < Test::Unit::TestCase
|
|
22
22
|
receiver.should_receive(:end_tracker_segment).once
|
23
23
|
receiver.should_receive(:end_export).once
|
24
24
|
|
25
|
-
m = Tracksperanto::
|
25
|
+
m = Tracksperanto::Tool::Crop.new(receiver, :left => -60, :bottom => 58)
|
26
26
|
m.start_export(720, 576)
|
27
27
|
m.start_tracker_segment("Tracker")
|
28
28
|
m.export_point(1, 60, 30, 0)
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
3
3
|
|
4
|
-
class
|
4
|
+
class FlipToolTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_action_description
|
7
|
-
assert_equal "Mirrors all the tracker paths horizontally", Tracksperanto::
|
7
|
+
assert_equal "Mirrors all the tracker paths horizontally", Tracksperanto::Tool::Flip.action_description
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_export_with_enabled_flip
|
@@ -12,7 +12,7 @@ class FlipMiddlewareTest < Test::Unit::TestCase
|
|
12
12
|
receiver.should_receive(:start_export).once.with(110, 120)
|
13
13
|
receiver.should_receive(:export_point).once.with(1, 100, 95, 0)
|
14
14
|
|
15
|
-
m = Tracksperanto::
|
15
|
+
m = Tracksperanto::Tool::Flip.new(receiver)
|
16
16
|
m.start_export(110, 120)
|
17
17
|
m.export_point(1, 10, 95, 0)
|
18
18
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
3
3
|
|
4
|
-
class
|
4
|
+
class FlopToolTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_action_description
|
7
|
-
assert_equal "Mirror all the tracker paths vertically", Tracksperanto::
|
7
|
+
assert_equal "Mirror all the tracker paths vertically", Tracksperanto::Tool::Flop.action_description
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_export_flip_and_flop
|
@@ -12,7 +12,7 @@ class FlopMiddlewareTest < Test::Unit::TestCase
|
|
12
12
|
receiver.should_receive(:start_export).once.with(110, 120)
|
13
13
|
receiver.should_receive(:export_point).once.with(1, 10, 25, 0)
|
14
14
|
|
15
|
-
m = Tracksperanto::
|
15
|
+
m = Tracksperanto::Tool::Flop.new(receiver)
|
16
16
|
m.start_export(110, 120)
|
17
17
|
m.export_point(1, 10, 95, 0)
|
18
18
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
3
3
|
|
4
|
-
class
|
4
|
+
class GoldenToolTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_action_description
|
7
|
-
assert_equal "Reset residual of all the trackers to zero", Tracksperanto::
|
7
|
+
assert_equal "Reset residual of all the trackers to zero", Tracksperanto::Tool::Golden.action_description
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_golden_bypasses_methods
|
@@ -16,7 +16,7 @@ class GoldenMiddlewareTest < Test::Unit::TestCase
|
|
16
16
|
receiver.should_receive(:end_tracker_segment).once
|
17
17
|
receiver.should_receive(:end_export).once
|
18
18
|
|
19
|
-
m = Tracksperanto::
|
19
|
+
m = Tracksperanto::Tool::Golden.new(receiver)
|
20
20
|
m.start_export(120, 120)
|
21
21
|
m.start_tracker_segment("Tracker")
|
22
22
|
m.export_point(0, 100, 100, 0.56)
|
@@ -1,21 +1,21 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
3
3
|
|
4
|
-
class
|
4
|
+
class LengthCutoffToolTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_action_description
|
7
|
-
assert_equal "Remove trackers that have less than the specified number of keyframes", Tracksperanto::
|
7
|
+
assert_equal "Remove trackers that have less than the specified number of keyframes", Tracksperanto::Tool::LengthCutoff.action_description
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_default_length_set_to_zero_and_ignored
|
11
11
|
receiver = flexmock
|
12
|
-
m = Tracksperanto::
|
12
|
+
m = Tracksperanto::Tool::LengthCutoff.new(receiver)
|
13
13
|
assert_equal 0, m.min_length
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_slip_supports_hash_init
|
17
17
|
receiver = flexmock
|
18
|
-
m = Tracksperanto::
|
18
|
+
m = Tracksperanto::Tool::LengthCutoff.new(receiver, :min_length => 23)
|
19
19
|
assert_equal 23, m.min_length
|
20
20
|
end
|
21
21
|
|
@@ -30,7 +30,7 @@ class LengthCutoffMiddlewareTest < Test::Unit::TestCase
|
|
30
30
|
receiver.should_receive(:end_export).once
|
31
31
|
|
32
32
|
|
33
|
-
m = Tracksperanto::
|
33
|
+
m = Tracksperanto::Tool::LengthCutoff.new(receiver, :min_length => 12)
|
34
34
|
m.start_export(120, 120)
|
35
35
|
m.start_tracker_segment("Tracker")
|
36
36
|
12.times {|t| m.export_point(t, 100, 100, 0) }
|
@@ -1,12 +1,12 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
3
3
|
|
4
|
-
class
|
4
|
+
class LensToolTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
include Approximately
|
7
7
|
|
8
8
|
def test_action_description
|
9
|
-
assert_equal "Apply or remove lens distortion with the Syntheyes algorithm", Tracksperanto::
|
9
|
+
assert_equal "Apply or remove lens distortion with the Syntheyes algorithm", Tracksperanto::Tool::LensDisto.action_description
|
10
10
|
end
|
11
11
|
|
12
12
|
def test_lens_bypasses_centerpoint
|
@@ -17,7 +17,7 @@ class LensMiddlewareTest < Test::Unit::TestCase
|
|
17
17
|
receiver.should_receive(:end_tracker_segment).once
|
18
18
|
receiver.should_receive(:end_export).once
|
19
19
|
|
20
|
-
m = Tracksperanto::
|
20
|
+
m = Tracksperanto::Tool::LensDisto.new(receiver, :k => 0.0168)
|
21
21
|
m.start_export(1920, 1080)
|
22
22
|
m.start_tracker_segment("Tracker")
|
23
23
|
m.export_point(1, 1920 / 2.0, 1080.0 / 2.0, 0)
|
@@ -29,12 +29,12 @@ class LensMiddlewareTest < Test::Unit::TestCase
|
|
29
29
|
receiver = flexmock
|
30
30
|
receiver.should_receive(:start_export).once.with(1920, 1080)
|
31
31
|
receiver.should_receive(:start_tracker_segment).once.with("Tracker")
|
32
|
-
receiver.should_receive(:export_point).once.with(1, approx(66.
|
32
|
+
receiver.should_receive(:export_point).once.with(1, approx(66.06), approx(43.99), approx(0))
|
33
33
|
|
34
34
|
receiver.should_receive(:end_tracker_segment).once
|
35
35
|
receiver.should_receive(:end_export).once
|
36
36
|
|
37
|
-
m = Tracksperanto::
|
37
|
+
m = Tracksperanto::Tool::LensDisto.new(receiver, :k => -0.0298, :kcube => 0.0078)
|
38
38
|
m.start_export(1920, 1080)
|
39
39
|
m.start_tracker_segment("Tracker")
|
40
40
|
m.export_point(1, 12.0, 14.0, 0)
|
@@ -46,11 +46,11 @@ class LensMiddlewareTest < Test::Unit::TestCase
|
|
46
46
|
receiver = flexmock
|
47
47
|
receiver.should_receive(:start_export).once.with(1920, 1080)
|
48
48
|
receiver.should_receive(:start_tracker_segment).once.with("Tracker")
|
49
|
-
receiver.should_receive(:export_point).once.with(1, approx(11.
|
49
|
+
receiver.should_receive(:export_point).once.with(1, approx(11.96), approx(13.98), 0)
|
50
50
|
receiver.should_receive(:end_tracker_segment).once
|
51
51
|
receiver.should_receive(:end_export).once
|
52
52
|
|
53
|
-
m = Tracksperanto::
|
53
|
+
m = Tracksperanto::Tool::LensDisto.new(receiver, :k => -0.0298, :kcube => 0.0078, :remove => true)
|
54
54
|
m.start_export(1920, 1080)
|
55
55
|
m.start_tracker_segment("Tracker")
|
56
56
|
m.export_point(1, 66.03001446825158, 43.978678913818925, 0)
|
@@ -66,8 +66,8 @@ class LensMiddlewareTest < Test::Unit::TestCase
|
|
66
66
|
receiver.should_receive(:end_tracker_segment).once
|
67
67
|
receiver.should_receive(:end_export).once
|
68
68
|
|
69
|
-
apply = Tracksperanto::
|
70
|
-
remove = Tracksperanto::
|
69
|
+
apply = Tracksperanto::Tool::LensDisto.new(receiver, :k => -0.0298, :kcube => 0.2178)
|
70
|
+
remove = Tracksperanto::Tool::LensDisto.new(apply, :k => -0.0298, :kcube => 0.2178, :remove => true)
|
71
71
|
|
72
72
|
remove.start_export(1920, 1080)
|
73
73
|
remove.start_tracker_segment("Tracker")
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
3
3
|
|
4
|
-
class
|
4
|
+
class LerpToolTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_action_description
|
7
|
-
assert_equal "Interpolate missing keyframes of all the trackers", Tracksperanto::
|
7
|
+
assert_equal "Interpolate missing keyframes of all the trackers", Tracksperanto::Tool::Lerp.action_description
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_lerp
|
11
11
|
receiver = flexmock
|
12
|
-
m = Tracksperanto::
|
12
|
+
m = Tracksperanto::Tool::Lerp.new(receiver)
|
13
13
|
receiver.should_receive(:start_export).with(720, 576).once
|
14
14
|
receiver.should_receive(:start_tracker_segment).with("Foo").once
|
15
15
|
receiver.should_receive(:export_point).with(1, 1.0, 2.0, 0).once
|
@@ -1,19 +1,19 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
3
3
|
|
4
|
-
class
|
4
|
+
class LintToolTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_action_description
|
7
|
-
assert_equal "Verify all the exported trackers and check for errors", Tracksperanto::
|
7
|
+
assert_equal "Verify all the exported trackers and check for errors", Tracksperanto::Tool::Lint.action_description
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_empty_export_raises
|
11
11
|
m = flexmock
|
12
12
|
m.should_receive(:start_export).once
|
13
13
|
|
14
|
-
ex = Tracksperanto::
|
14
|
+
ex = Tracksperanto::Tool::Lint.new(m)
|
15
15
|
ex.start_export(100, 100)
|
16
|
-
assert_raise(Tracksperanto::
|
16
|
+
assert_raise(Tracksperanto::Tool::Lint::NoTrackersExportedError) do
|
17
17
|
ex.end_export
|
18
18
|
end
|
19
19
|
|
@@ -24,11 +24,11 @@ class LintMiddlewareTest < Test::Unit::TestCase
|
|
24
24
|
m.should_receive(:start_export).once
|
25
25
|
m.should_receive(:start_tracker_segment).once
|
26
26
|
|
27
|
-
ex = Tracksperanto::
|
27
|
+
ex = Tracksperanto::Tool::Lint.new(m)
|
28
28
|
ex.start_export(100, 100)
|
29
29
|
ex.start_tracker_segment("Foo")
|
30
30
|
|
31
|
-
assert_raise(Tracksperanto::
|
31
|
+
assert_raise(Tracksperanto::Tool::Lint::EmptyTrackerSentError) do
|
32
32
|
ex.end_tracker_segment
|
33
33
|
end
|
34
34
|
end
|
@@ -39,12 +39,12 @@ class LintMiddlewareTest < Test::Unit::TestCase
|
|
39
39
|
m.should_receive(:start_tracker_segment).once
|
40
40
|
m.should_receive(:export_point).once
|
41
41
|
|
42
|
-
ex = Tracksperanto::
|
42
|
+
ex = Tracksperanto::Tool::Lint.new(m)
|
43
43
|
ex.start_export(100, 100)
|
44
44
|
ex.start_tracker_segment("Foo")
|
45
45
|
ex.export_point(2, 123.3, 456.0, 0.0)
|
46
46
|
|
47
|
-
assert_raise(Tracksperanto::
|
47
|
+
assert_raise(Tracksperanto::Tool::Lint::NonSequentialKeyframes) do
|
48
48
|
ex.export_point(1, 123.3, 456.0, 0.0)
|
49
49
|
end
|
50
50
|
end
|
@@ -56,7 +56,7 @@ class LintMiddlewareTest < Test::Unit::TestCase
|
|
56
56
|
m.should_receive(:start_tracker_segment).once
|
57
57
|
m.should_receive(:export_point).twice
|
58
58
|
|
59
|
-
ex = Tracksperanto::
|
59
|
+
ex = Tracksperanto::Tool::Lint.new(m)
|
60
60
|
ex.start_export(100, 100)
|
61
61
|
ex.start_tracker_segment("Foo")
|
62
62
|
ex.export_point(-1, 123.3, 456.0, 0.0)
|
@@ -68,11 +68,11 @@ class LintMiddlewareTest < Test::Unit::TestCase
|
|
68
68
|
m.should_receive(:start_export).once
|
69
69
|
m.should_receive(:start_tracker_segment).once
|
70
70
|
|
71
|
-
ex = Tracksperanto::
|
71
|
+
ex = Tracksperanto::Tool::Lint.new(m)
|
72
72
|
ex.start_export(100, 100)
|
73
73
|
ex.start_tracker_segment("Foo")
|
74
74
|
|
75
|
-
assert_raise(Tracksperanto::
|
75
|
+
assert_raise(Tracksperanto::Tool::Lint::TrackerRestartedError) do
|
76
76
|
ex.start_tracker_segment("Bar")
|
77
77
|
end
|
78
78
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
3
3
|
|
4
|
-
class
|
4
|
+
class MoveToFirstFrameToolTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_action_description
|
7
|
-
assert_equal "Move all the keyframes in time so that the
|
7
|
+
assert_equal "Move all the keyframes in time so that the track starts at frame 1", Tracksperanto::Tool::MoveToFirst.action_description
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_move_to_first_frame
|
@@ -21,7 +21,7 @@ class MoveToFirstFrameMiddlewareTest < Test::Unit::TestCase
|
|
21
21
|
|
22
22
|
receiver.should_receive(:end_export)
|
23
23
|
|
24
|
-
m = Tracksperanto::
|
24
|
+
m = Tracksperanto::Tool::MoveToFirst.new(receiver)
|
25
25
|
|
26
26
|
m.start_export(120, 120)
|
27
27
|
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
3
3
|
|
4
|
-
class
|
4
|
+
class PadToolTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_action_description
|
7
|
-
assert_equal "Pad or crop the image by a fraction of it's original size", Tracksperanto::
|
7
|
+
assert_equal "Pad or crop the image by a fraction of it's original size", Tracksperanto::Tool::Pad.action_description
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_shift_supports_hash_init
|
11
11
|
receiver = flexmock
|
12
|
-
m = Tracksperanto::
|
12
|
+
m = Tracksperanto::Tool::Pad.new(receiver,
|
13
13
|
:left_pad => 0.5, :right_pad => 0, :top_pad => -0.2)
|
14
14
|
assert_in_delta 0.5, m.left_pad, 0.001
|
15
15
|
assert_in_delta 0.0, m.bottom_pad, 0.001
|
@@ -25,7 +25,7 @@ class PadMiddlewareTest < Test::Unit::TestCase
|
|
25
25
|
receiver.should_receive(:end_tracker_segment).once
|
26
26
|
receiver.should_receive(:end_export).once
|
27
27
|
|
28
|
-
m = Tracksperanto::
|
28
|
+
m = Tracksperanto::Tool::Pad.new(receiver, :left_pad => -0.25, :bottom_pad => 0.10)
|
29
29
|
m.start_export(720, 576)
|
30
30
|
m.start_tracker_segment("Tracker")
|
31
31
|
m.export_point(1, 60, 30, 0)
|
@@ -1,15 +1,15 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
3
3
|
|
4
|
-
class
|
4
|
+
class PrefixToolTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_action_description
|
7
|
-
assert_equal "Prefix tracker names with text", Tracksperanto::
|
7
|
+
assert_equal "Prefix tracker names with text", Tracksperanto::Tool::Prefix.action_description
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_prefix_supports_hash_init
|
11
11
|
receiver = flexmock
|
12
|
-
m = Tracksperanto::
|
12
|
+
m = Tracksperanto::Tool::Prefix.new(receiver, :prefix => "foo")
|
13
13
|
assert_equal "foo", m.prefix
|
14
14
|
end
|
15
15
|
|
@@ -17,7 +17,7 @@ class PrefixMiddlewareTest < Test::Unit::TestCase
|
|
17
17
|
receiver = flexmock
|
18
18
|
receiver.should_receive(:start_tracker_segment).once.with("Pre_Tracker")
|
19
19
|
|
20
|
-
m = Tracksperanto::
|
20
|
+
m = Tracksperanto::Tool::Prefix.new(receiver, :prefix => "Pre_")
|
21
21
|
m.start_tracker_segment("Tracker")
|
22
22
|
end
|
23
23
|
|
@@ -25,7 +25,7 @@ class PrefixMiddlewareTest < Test::Unit::TestCase
|
|
25
25
|
receiver = flexmock
|
26
26
|
receiver.should_receive(:start_tracker_segment).once.with("Tracker")
|
27
27
|
|
28
|
-
m = Tracksperanto::
|
28
|
+
m = Tracksperanto::Tool::Prefix.new(receiver)
|
29
29
|
m.start_tracker_segment("Tracker")
|
30
30
|
end
|
31
31
|
|
@@ -1,22 +1,22 @@
|
|
1
1
|
# -*- encoding : utf-8 -*-
|
2
2
|
require File.expand_path(File.dirname(__FILE__)) + '/../helper'
|
3
3
|
|
4
|
-
class
|
4
|
+
class ReformatToolTest < Test::Unit::TestCase
|
5
5
|
|
6
6
|
def test_action_description
|
7
|
-
assert_equal "Reformat the comp together with it's trackers to conform to a specific format", Tracksperanto::
|
7
|
+
assert_equal "Reformat the comp together with it's trackers to conform to a specific format", Tracksperanto::Tool::Reformat.action_description
|
8
8
|
end
|
9
9
|
|
10
10
|
def test_default_params_zeroed
|
11
11
|
receiver = flexmock
|
12
|
-
m = Tracksperanto::
|
12
|
+
m = Tracksperanto::Tool::Reformat.new(receiver)
|
13
13
|
assert_equal 0, m.width
|
14
14
|
assert_equal 0, m.height
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_reformat_supports_hash_init
|
18
18
|
receiver = flexmock
|
19
|
-
m = Tracksperanto::
|
19
|
+
m = Tracksperanto::Tool::Reformat.new(receiver, :width => 1920, :height => 1080)
|
20
20
|
assert_equal 1920, m.width
|
21
21
|
assert_equal 1080, m.height
|
22
22
|
end
|
@@ -29,7 +29,7 @@ class ReformatMiddlewareTest < Test::Unit::TestCase
|
|
29
29
|
receiver.should_receive(:start_export).once.with(1920,1080)
|
30
30
|
receiver.should_receive(:end_export).once
|
31
31
|
|
32
|
-
m = Tracksperanto::
|
32
|
+
m = Tracksperanto::Tool::Reformat.new(receiver, :width => 1920, :height => 1080)
|
33
33
|
|
34
34
|
m.start_export(720, 576)
|
35
35
|
m.end_export
|