![]() |
PFTrack Documentation | Python Node API |
The Python Node API is the API for writing scripts with the Python Node or building export scripts for the Scene Export node.
Unlike Macros, these scripts can access the data that is flowing through the tracking tree.
Finally, Compound Nodes can also be used to group multiple nodes into a single entity and create simple customization GUI elements.
We provide several example scripts which can be used as a starting point for customization:
- animateCamera.py: animates the focal length and translation values for the first camera
- filterTracks.py: averages tracker positions in neighbouring frames
- hideBadPoints.py: hides trackers in frames where their residual error is larger than a specific value
- scaleSurvey.py: scales trackers' survey positions by fixed factor
- fetchMetaData.py: displays the media metadata in a clip
- import2dt.py: creates tracker data for the primary camera from a text file with the format:
# Tracker name
"Tracker0001"
# Number of tracked frames
65
# Frame no, x position, y position, matching score
1 338.47 258.90 1.000
2 348.20 258.94 0.982
3 355.14 254.65 0.974
...
- XML.py: Exports camera information to XML.
Additional export scripts are also available to view in the exports sub-directory where the application is installed.
PFTrack is distributed with standard Python 3.10 modules and sets the PYTHONPATH
environment variables to its internal install location to ensure that it does not attempt to use any locally installed version of Python which maybe incompatible (PFTrack is based on Python version 3.10).
If your macro wishes to utilise additional modules you can set the PIXELFARM_KEEP_PYTHONPATH
environment variables (to any value) to prevent PFTrack setting them, thereby ensuring your local Python installation is picked up and useable.
Please note that when doing this, you will need to set the PYTHONPATH
environment variable as well to point to the specific location of the Python installation containing your modules.
Environment variables can be difficult to specify on certain operating systems, and to help with this environment variables can be read from an environment.txt
file located either in the directory where the application is installed (so that it applies to all users) or in a specific user's documents directory:
environment.txt
For example:
PYTHONPATH=/usr/lib64/python3.10
PIXELFARM_KEEP_PYTHONPATH=1