Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

manual_tracking format issue #373

Closed
apiszcz opened this issue Dec 26, 2016 · 2 comments
Closed

manual_tracking format issue #373

apiszcz opened this issue Dec 26, 2016 · 2 comments

Comments

@apiszcz
Copy link

apiszcz commented Dec 26, 2016

Possible format issue in interpolators.py

  File "tracktest.py", line 5, in <module>
    trajectories = manual_tracking(clip, t1=5, t2=8, fps=1, nobjects=1, savefile="track.txt")
  File "<decorator-gen-101>", line 2, in manual_tracking
  File "lib\moviepy\decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "<decorator-gen-100>", line 2, in manual_tracking
  File "lib\moviepy\decorators.py", line 137, in use_clip_fps_by_default
    return f(clip, *new_a, **new_kw)
  File "lib\moviepy\video\tools\tracking.py", line 132, in manual_tracking
    Trajectory.save_list(result, savefile)
  File "lib\moviepy\video\tools\interpolators.py", line 68, in save_list
    header = "\t".join(N*['t (ms)', 'x', 'y']))
  File "lib\numpy\lib\npyio.py", line 1162, in savetxt
    % (str(X.dtype), format))
TypeError: Mismatch between array dtype ('object') and format specifier ('%d')
@dermusikman
Copy link
Contributor

dermusikman commented Jan 5, 2017

I have a similar problem:

>>> tracking.manual_tracking(clip.subclip(0,4.5), nobjects=2, savefile="left-right-hat.txt")
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/numpy/lib/npyio.py", line 1158, in savetxt
    fh.write(asbytes(format % tuple(row) + newline))
TypeError: %d format: a number is required, not zip

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<decorator-gen-212>", line 2, in manual_tracking
  File "/usr/lib/python3.5/site-packages/moviepy/decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "<decorator-gen-211>", line 2, in manual_tracking
  File "/usr/lib/python3.5/site-packages/moviepy/decorators.py", line 137, in use_clip_fps_by_default
    return f(clip, *new_a, **new_kw)
  File "/usr/lib/python3.5/site-packages/moviepy/video/tools/tracking.py", line 132, in manual_tracking
    Trajectory.save_list(result, savefile)
  File "/usr/lib/python3.5/site-packages/moviepy/video/tools/interpolators.py", line 68, in save_list
    header = "\t".join(N*['t (ms)', 'x', 'y']))
  File "/usr/lib/python3.5/site-packages/numpy/lib/npyio.py", line 1162, in savetxt
    % (str(X.dtype), format))
TypeError: Mismatch between array dtype ('object') and format specifier ('%d')
>>> tracking.manual_tracking(clip.subclip(0,frame), nobjects=2, savefile="./left-right-hat.data")
Traceback (most recent call last):
  File "/usr/lib/python3.5/site-packages/numpy/lib/npyio.py", line 1158, in savetxt
    fh.write(asbytes(format % tuple(row) + newline))
TypeError: %d format: a number is required, not zip

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<decorator-gen-212>", line 2, in manual_tracking
  File "/usr/lib/python3.5/site-packages/moviepy/decorators.py", line 89, in wrapper
    return f(*new_a, **new_kw)
  File "<decorator-gen-211>", line 2, in manual_tracking
  File "/usr/lib/python3.5/site-packages/moviepy/decorators.py", line 137, in use_clip_fps_by_default
    return f(clip, *new_a, **new_kw)
  File "/usr/lib/python3.5/site-packages/moviepy/video/tools/tracking.py", line 132, in manual_tracking
    Trajectory.save_list(result, savefile)
  File "/usr/lib/python3.5/site-packages/moviepy/video/tools/interpolators.py", line 68, in save_list
    header = "\t".join(N*['t (ms)', 'x', 'y']))
  File "/usr/lib/python3.5/site-packages/numpy/lib/npyio.py", line 1162, in savetxt
    % (str(X.dtype), format))
TypeError: Mismatch between array dtype ('object') and format specifier ('%d')`

Using Python 3.5. It writes the following to the intended file on one line:
# t (ms) x y t (ms) x y

ghost pushed a commit that referenced this issue Apr 4, 2017
* Fix Trajectory().save_list() format issue

* Use consistent header in Trajectory.savetxt()
@keikoro
Copy link
Collaborator

keikoro commented Nov 25, 2017

Looks like a PR with a fix was merged. Closing.

@keikoro keikoro closed this as completed Nov 25, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants