Python binding to pfstools can be found in src/python.
It was written in C++ and needs to be compiled by at least C++11. To build python module make sure to run `git submodule update --init --recursive` before build
If you want to install pfstools with python, turn the WITH_PYTHON option on. The compiled binding would be a dynamic libary, and it would be installed in site-package place. You could also specify the installation location with PYTHON_PACKAGES_PATH option.
Since the code uses the command line functionality, only Unix platform is supported.
# Example usage
The central data structure of the pfs tool is the `Frame` class. The following example code illustrate how to use this tool.
```python
import pypfs as pfs
frame = pfs.Frame.read('Fairchild.exr') # reading an image from pfstools
frame.show() # inspect the image using pfsview
frame.show(opengl=True) # also, inspect the image using pfsglview
X, Y, Z = frame.X, frame.Y, frame.Z # internal frames was represented by the XYZ colorspace
print(Y.max()) # they are all numpy 2d array
frame.X = X+3 # and they are both readable and writable
frame.write('Fairchild.exr') # you could write them back to files
# it can also be constructed from numpy 3d array in [Height, Width, Channel] format (same as opencv)
# you should also specify the colorspace and the default is RGB space
frame = pfs.Frame.from_numpy(np.stack([X, Y, Z], axis=-1), pfs.XYZ)
# it is also possible to get the numpy array from it
rgb = frame.numpy(pfs.RGB)
```