tracksperanto 1.5.7 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +5 -0
- data/lib/export/match_mover.rb +2 -2
- data/lib/import/match_mover.rb +1 -1
- data/lib/tracksperanto.rb +1 -1
- data/lib/tracksperanto/keyframe.rb +6 -7
- data/lib/tracksperanto/tracker.rb +5 -0
- data/test/export/samples/ref_matchmover.rz2 +42 -42
- data/test/import/test_match_mover_import.rb +2 -2
- data/test/test_tracker.rb +14 -0
- metadata +2 -2
data/History.txt
CHANGED
data/lib/export/match_mover.rb
CHANGED
@@ -16,10 +16,10 @@ class Tracksperanto::Export::MatchMover < Tracksperanto::Export::Base
|
|
16
16
|
KEYFRAME_TEMPLATE = "\t%d\t %.3f %.3f p+( %.6f )\t"
|
17
17
|
|
18
18
|
def start_export( img_width, img_height)
|
19
|
+
@height = img_height
|
19
20
|
@io.puts(PREAMBLE.gsub(/2560/, img_width.to_s).gsub(/1080/, img_height.to_s))
|
20
21
|
end
|
21
22
|
|
22
|
-
|
23
23
|
def start_tracker_segment(tracker_name)
|
24
24
|
@tracker_name = tracker_name
|
25
25
|
@at_first_point = true
|
@@ -32,7 +32,7 @@ class Tracksperanto::Export::MatchMover < Tracksperanto::Export::Base
|
|
32
32
|
|
33
33
|
def export_point(frame, abs_float_x, abs_float_y, float_residual)
|
34
34
|
template = @at_first_point ? FIRST_KEYFRAME_TEMPLATE : KEYFRAME_TEMPLATE
|
35
|
-
values = [frame + 1, abs_float_x, abs_float_y, (1 - float_residual)]
|
35
|
+
values = [frame + 1, abs_float_x, @height - abs_float_y, (1 - float_residual)]
|
36
36
|
@io.puts(template % values)
|
37
37
|
@at_first_point = false
|
38
38
|
end
|
data/lib/import/match_mover.rb
CHANGED
@@ -52,7 +52,7 @@ class Tracksperanto::Import::MatchMover < Tracksperanto::Import::Base
|
|
52
52
|
Tracksperanto::Keyframe.new(
|
53
53
|
:frame => (frame.to_i() - 1),
|
54
54
|
:abs_x => x,
|
55
|
-
:abs_y => y,
|
55
|
+
:abs_y => @height - y.to_f, # Top-left in MM
|
56
56
|
:residual => extract_residual(residual)
|
57
57
|
)
|
58
58
|
end
|
data/lib/tracksperanto.rb
CHANGED
@@ -1,10 +1,9 @@
|
|
1
|
-
# Internal representation of a keyframe, that carries info on the frame location in the clip, x y and residual
|
2
|
-
#
|
3
|
-
#
|
4
|
-
#
|
5
|
-
# coordinate
|
6
|
-
#
|
7
|
-
# correlation is how sure the tracker is about what it's doing). Residual is the inverse of
|
1
|
+
# Internal representation of a keyframe, that carries info on the frame location in the clip, x y and residual.
|
2
|
+
#
|
3
|
+
# Franme numbers are zero-based (frame 0 is first frame of the clip).
|
4
|
+
# X-coordinate (abs_x) is absolute pixels from lower left corner of the comp to the right
|
5
|
+
# Y-coordinate (abs_y) is absolute pixels from lower left corner of the comp up
|
6
|
+
# Residual is how far in pixels the tracker strolls away, and is the inverse of
|
8
7
|
# correlation (with total correlation of one the residual excursion becomes zero).
|
9
8
|
class Tracksperanto::Keyframe
|
10
9
|
include Tracksperanto::Casts
|
@@ -41,4 +41,9 @@ class Tracksperanto::Tracker < DelegateClass(Array)
|
|
41
41
|
def inspect
|
42
42
|
"<T #{name.inspect} with #{length} keyframes>"
|
43
43
|
end
|
44
|
+
|
45
|
+
# Hack - prevents the Tracker to be flattened into keyframes
|
46
|
+
# when an Array of Trackers gets Array#flatten'ed
|
47
|
+
def to_ary; end
|
48
|
+
private :to_ary
|
44
49
|
end
|
@@ -4,49 +4,49 @@ imageSequence "Sequence 01"
|
|
4
4
|
}
|
5
5
|
pointTrack "Parabolic_1_from_top_left" rgb( 255 0 0 )
|
6
6
|
{
|
7
|
-
1 0.000
|
8
|
-
2 96.000
|
9
|
-
3 192.000
|
10
|
-
4 288.000
|
11
|
-
5 384.000
|
12
|
-
6 480.000
|
13
|
-
7 576.000
|
14
|
-
8 672.000
|
15
|
-
9 768.000
|
16
|
-
10 864.000
|
17
|
-
11 960.000
|
18
|
-
12 1056.000
|
19
|
-
13 1152.000
|
20
|
-
14 1248.000
|
21
|
-
15 1344.000
|
22
|
-
16 1440.000
|
23
|
-
17 1536.000
|
24
|
-
18 1632.000
|
25
|
-
19 1728.000
|
26
|
-
20 1824.000
|
27
|
-
21 1920.000
|
7
|
+
1 0.000 0.000 ki( 0.8 ) s( 66 66 64 64 ) p( 24 24 25 25 )
|
8
|
+
2 96.000 205.200 p+( 0.952381 )
|
9
|
+
3 192.000 388.800 p+( 0.904762 )
|
10
|
+
4 288.000 550.800 p+( 0.857143 )
|
11
|
+
5 384.000 691.200 p+( 0.809524 )
|
12
|
+
6 480.000 810.000 p+( 0.761905 )
|
13
|
+
7 576.000 907.200 p+( 0.714286 )
|
14
|
+
8 672.000 982.800 p+( 0.666667 )
|
15
|
+
9 768.000 1036.800 p+( 0.619048 )
|
16
|
+
10 864.000 1069.200 p+( 0.571429 )
|
17
|
+
11 960.000 1080.000 p+( 0.523810 )
|
18
|
+
12 1056.000 1069.200 p+( 0.476190 )
|
19
|
+
13 1152.000 1036.800 p+( 0.428571 )
|
20
|
+
14 1248.000 982.800 p+( 0.380952 )
|
21
|
+
15 1344.000 907.200 p+( 0.333333 )
|
22
|
+
16 1440.000 810.000 p+( 0.285714 )
|
23
|
+
17 1536.000 691.200 p+( 0.238095 )
|
24
|
+
18 1632.000 550.800 p+( 0.190476 )
|
25
|
+
19 1728.000 388.800 p+( 0.142857 )
|
26
|
+
20 1824.000 205.200 p+( 0.095238 )
|
27
|
+
21 1920.000 0.000 p+( 0.047619 )
|
28
28
|
}
|
29
29
|
pointTrack "Parabolic_2_from_bottom_right" rgb( 255 0 0 )
|
30
30
|
{
|
31
|
-
1 1920.000
|
32
|
-
2 1824.000
|
33
|
-
3 1728.000
|
34
|
-
4 1632.000
|
35
|
-
5 1536.000
|
36
|
-
6 1440.000
|
37
|
-
7 1344.000
|
38
|
-
8 1248.000
|
39
|
-
9 1152.000
|
40
|
-
10 1056.000
|
41
|
-
11 960.000
|
42
|
-
12 864.000
|
43
|
-
13 768.000
|
44
|
-
14 672.000
|
45
|
-
15 576.000
|
46
|
-
16 480.000
|
47
|
-
17 384.000
|
48
|
-
18 288.000
|
49
|
-
19 192.000
|
50
|
-
20 96.000
|
51
|
-
21 0.000
|
31
|
+
1 1920.000 1080.000 ki( 0.8 ) s( 66 66 64 64 ) p( 24 24 25 25 )
|
32
|
+
2 1824.000 874.800 p+( 0.952381 )
|
33
|
+
3 1728.000 691.200 p+( 0.904762 )
|
34
|
+
4 1632.000 529.200 p+( 0.857143 )
|
35
|
+
5 1536.000 388.800 p+( 0.809524 )
|
36
|
+
6 1440.000 270.000 p+( 0.761905 )
|
37
|
+
7 1344.000 172.800 p+( 0.714286 )
|
38
|
+
8 1248.000 97.200 p+( 0.666667 )
|
39
|
+
9 1152.000 43.200 p+( 0.619048 )
|
40
|
+
10 1056.000 10.800 p+( 0.571429 )
|
41
|
+
11 960.000 0.000 p+( 0.523810 )
|
42
|
+
12 864.000 10.800 p+( 0.476190 )
|
43
|
+
13 768.000 43.200 p+( 0.428571 )
|
44
|
+
14 672.000 97.200 p+( 0.380952 )
|
45
|
+
15 576.000 172.800 p+( 0.333333 )
|
46
|
+
16 480.000 270.000 p+( 0.285714 )
|
47
|
+
17 384.000 388.800 p+( 0.238095 )
|
48
|
+
18 288.000 529.200 p+( 0.190476 )
|
49
|
+
19 192.000 691.200 p+( 0.142857 )
|
50
|
+
20 96.000 874.800 p+( 0.095238 )
|
51
|
+
21 0.000 1080.000 p+( 0.047619 )
|
52
52
|
}
|
@@ -31,13 +31,13 @@ class MatchMoverImportTest < Test::Unit::TestCase
|
|
31
31
|
|
32
32
|
assert_equal 0, first_kf.frame
|
33
33
|
assert_in_delta 649.523, first_kf.abs_x, DELTA
|
34
|
-
assert_in_delta
|
34
|
+
assert_in_delta 656.071, first_kf.abs_y, DELTA
|
35
35
|
assert_in_delta 0.2, first_kf.residual, DELTA
|
36
36
|
|
37
37
|
last_kf = first_t[-1]
|
38
38
|
assert_equal 130, last_kf.frame
|
39
39
|
assert_in_delta 603.148, last_kf.abs_x, DELTA
|
40
|
-
assert_in_delta
|
40
|
+
assert_in_delta 351.54, last_kf.abs_y, DELTA
|
41
41
|
assert_in_delta 0.027457, last_kf.residual, DELTA
|
42
42
|
end
|
43
43
|
|
data/test/test_tracker.rb
CHANGED
@@ -16,6 +16,20 @@ class TrackerTest < Test::Unit::TestCase
|
|
16
16
|
assert_respond_to t, :keyframes
|
17
17
|
end
|
18
18
|
|
19
|
+
def test_properly_ignores_flattening
|
20
|
+
t = []
|
21
|
+
t << Tracksperanto::Tracker.new(:name => "Abc")
|
22
|
+
t[-1].keyframe! :abs_x => 12, :abs_y => 23, :frame => 1
|
23
|
+
t[-1].keyframe! :abs_x => 13, :abs_y => 24, :frame => 2
|
24
|
+
|
25
|
+
t << Tracksperanto::Tracker.new(:name => "Cde")
|
26
|
+
t[-1].keyframe! :abs_x => 12, :abs_y => 23, :frame => 1
|
27
|
+
t[-1].keyframe! :abs_x => 13, :abs_y => 24, :frame => 2
|
28
|
+
|
29
|
+
assert_kind_of Tracksperanto::Tracker, t.flatten[0]
|
30
|
+
assert_equal 2, t.flatten.length
|
31
|
+
end
|
32
|
+
|
19
33
|
def test_supports_hash_init
|
20
34
|
assert_equal "Foo", Tracksperanto::Tracker.new(:name => "Foo").name
|
21
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.
|
4
|
+
version: 1.6.0
|
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-
|
12
|
+
date: 2009-11-16 00:00:00 +01:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|