Created
February 23, 2016 18:16
-
-
Save groakat/b43fe09346616d8cb0ed to your computer and use it in GitHub Desktop.
Import Tracks into Blender
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bpy | |
import numpy as np | |
import os | |
img_no = 77 | |
in_folder = '/Volumes/Seagate_Backup_Plus_Drive/datasets/mech-sys/3d/rgb/bus/seq4/feat/fast_points' | |
img_template = 'image-{:04d}.npy' | |
clip = bpy.data.movieclips[0] | |
width=clip.size[0] | |
height=clip.size[1] | |
locations = np.load(os.path.join(in_folder, img_template.format(img_no))) | |
markers = [] | |
for i, loc in enumerate(locations): | |
m = clip.tracking.tracks.new("Track_{:03d}".format(i), frame=img_no) | |
m.markers.insert_frame(img_no,co=(loc[1] / width, 1 - loc[0] / height)) | |
m.pattern_match = 'PREV_FRAME' | |
m.motion_model = 'LocRot' | |
m.correlation_min = 0.6000000238418579 | |
m.markers[0].search_max = (0.0277, 0.0493) | |
m.markers[0].search_min = (-0.0277, -0.0493) | |
markers += [m] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment