7
$\begingroup$

I am attempting to make these GUI steps into a script. When I follow this process manually, I get a tracking error under 1 and I get some great matches. This is far better than autotrack.

import bpy

Step 1 - Set tracking settings extra correlation to .99:

bpy.data.movieclips["Name.png"].(null) = 0.99

Step 2 - Loop through 1000 times

When in loop, it loops but only tracks one frame forward:

for loopv in range (1000):

Step 3 - Detect Features

bpy.ops.clip.detect_features(ctx)

Step 4 - Track Features 1 Frame

bpy.ops.clip.track_markers(ctx,backwards=False, sequence=False)

Step 5 - Deselect all features

bpy.ops.clip.select_all(ctx,action='TOGGLE')

or

bpy.ops.object.select_all(ctx,action='DESELECT')

Step 6 - End Indentation of loop and Return to Step 2

This is my current code. I have to hit Run Script. over and over, for it to work and go through all the frames of the clip.

import bpy
import random

#for loopv in range (1000):
ctx = bpy.context.copy()
for area in bpy.context.screen.areas:
   if area.type == 'CLIP_EDITOR':
   ctx['area'] = area

bpy.ops.clip.select_all(ctx,action='DESELECT')
bpy.ops.clip.detect_features(ctx)
bpy.ops.clip.track_markers(ctx,backwards=False, sequence=False)
$\endgroup$
  • $\begingroup$ I have started over and tried to layout exactly what I am trying to accomplish. Thanks for any help. @brockmann $\endgroup$ – Jack Feet Jun 12 at 8:21
  • $\begingroup$ I have also tried this import bpy import random ctx = bpy.context.copy() for area in bpy.context.screen.areas: if area.type == 'CLIP_EDITOR': ctx['area'] = area bpy.ops.clip.select_all(ctx,action='DESELECT') for loopv in range (10): bpy.ops.clip.detect_features(ctx) bpy.ops.clip.track_markers(ctx,backwards=False, sequence=False) @batFinger $\endgroup$ – Jack Feet Jun 12 at 8:26
  • 1
    $\begingroup$ So the idea is to have blender create unique trackers from detected features for every frame? $\endgroup$ – susu Jun 13 at 7:56
  • 2
    $\begingroup$ I'm not sure, I am of the opinion that a few well placed but accurate tracking points is all that is needed, instead of a whole bunch of them. But I know that other tracking and 3d reconstruction software does track every possible feature the same way you are trying to implement. I'm curious of the results. There is a long post on tips on motion traking on this site, you might want to check it out: blender.stackexchange.com/questions/42329 . There is also a wonderful script to work with weights in order to refine camera solving here: blender.stackexchange.com/a/71785/92768 $\endgroup$ – susu Jun 13 at 15:16
  • 1
    $\begingroup$ Same issue, I guess the frame of the clip does not update. Test operator to execute in the clip editor: pastebin.com/sweqpsRJ Just switch to tracking workspace, load up any clip of your choice and eg. this one and run the script. Idea is to perform the script itself frame by frame, will add more markers each frame by calling detect_features() and track them per frame which apparently gives better results @batFINGER OP just wants to avoid clicking run script over and over again. $\endgroup$ – brockmann Jun 20 at 13:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.