Skip to main content
edited title
Link
susu
  • 14.2k
  • 3
  • 26
  • 48

Tracking script in Script to auto-detect features to track using Python

Notice removed Draw attention by CommunityBot
Bounty Ended with no winning answer by CommunityBot
Notice added Draw attention by susu
Bounty Started worth 100 reputation by susu
Notice removed Draw attention by CommunityBot
Bounty Ended with no winning answer by CommunityBot
Tweeted twitter.com/StackBlender/status/1272227310717095936
Notice added Draw attention by brockmann
Bounty Started worth 50 reputation by brockmann
code indentation
Source Link
brockmann
  • 12.8k
  • 4
  • 51
  • 94

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)

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)

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)
removed quote formatting, simplified formatting
Source Link
Ray Mairlot
  • 29.4k
  • 12
  • 105
  • 126

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

import bpy

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

Set tracking settings extra correlation to .99
Code Tried bpy.data.movieclips["Name.png"].(null) = 0.99

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

Step 2
 - Loop through 1000 times

Loop through 1000 times When in loop, it loops but only tracks one frame forward
Code for loopv in range (1000):

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

for loopv in range (1000):

Step 3
  - Detect Features

Detect Features
Code bpy.ops.clip.detect_features(ctx)

bpy.ops.clip.detect_features(ctx)

Step 4
  - Track Features 1 Frame

Track Features 1 Frame
Code bpy.ops.clip.track_markers(ctx,backwards=False, sequence=False)

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

Step 5
  - Deselect all features

Deselect all features
Code bpy.ops.clip.select_all(ctx,action='TOGGLE') or bpy.ops.object.select_all(ctx,action='DESELECT')

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

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)

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
Code Tried 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
Code for loopv in range (1000):

Step 3
 

Detect Features
Code bpy.ops.clip.detect_features(ctx)

Step 4
 

Track Features 1 Frame
Code bpy.ops.clip.track_markers(ctx,backwards=False, sequence=False)

Step 5
 

Deselect all features
Code 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)

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)
added 21 characters in body
Source Link
Loading
Source Link
Loading