-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add pybind11 bindings for core classes #15
Comments
See discussion: OpenPIV/openpiv-python#224 |
Should we include the logging functions? It seems quite straight forward without the logging library as there seems to be only standard libraries. I haven't figured out how to install c++ dependencies reliably on different operating systems in setup.py to get a minimum working example. |
No real reason to include spdlog if that's causing a problem, and its use is not widespread yet. If you already have some WIP I'd be more than happy to take a look - perhaps raise a PR to a new branch here? |
Please expect some time for a wrapper to be started and or completed since I started learning c++ only 4 weeks ago. However, I'll see how far I can get since I already wrapped a gaussian filter as an experiment. |
For some reason, setup.py doesn't know how to deal with the header files. I'm trying to wrap a modified version of the processing example that has a declaration like; void correlate_images(
py::array_t<float> cmatrix,
py::array_t<float> imgA,
py::array_t<float> imgB,
py::tuple window_size,
py::tuple overlap,
py::bool_ center_grid_on_image
);
The function can be modified to return a numpy array |
Should we include vcpkg or use setuptools to compile the package? |
I was planning on trying vcpkg (for pybind11) and cmake (for compilation) - I have some time over Easter weekend so was planning on sketching this out to make sure it works. |
Currently, the wrapped functions and classes under pycoreopenpiv are not really usable as they have non-native data type returns (For instance, core::image::data() returns a pixel type that cannot be casted into a numpy array and has limited use). When I have time, should I play around with your wrapper to make it more python friendly? I have future plans on utilizing this repository more often so I can add more features while learning more about c++ and pybind11 (e.g., I want to add morphological and convolution filters and make the wrapper more user friendly). |
Agreed! it's on my list of things to do - basically python has the concept of a buffer protocol which is what we need to use to allow seamless interchange from numpy to the core image type: https://pybind11.readthedocs.io/en/stable/advanced/pycpp/numpy.html Any/all contributions welcome; the aim is - as the title suggests - to provide python bindings to the core classes and also to allow interoperability with other more commonly used libraries such as numpy, pandas. |
I tried compiling your Python bindings for libopenpiv, but I get a lengthy compiler error, presumably due to pybind11 not handling type-deductions properly for one reason or another. |
Apparently, commenting lines |
thanks, will take a look |
I took a look and apart from a couple of warnings (which are now fixed) the code compiles and works fine:
Of the two install routes covered in README.md, using setup.py doesn't appear to work on windows, but manually building using cmake is fine:
import pyopenpivcore as popc
import numpy as np
from matplotlib import pyplot as plt
ima = popc.load_g_u16('../../../examples/data/test1/exp1_001_a.tiff')
ima_np = np.array(ima, copy=False)
plt.imshow(ima_np, cmap='gray')
plt.show() This shows a few things:
|
No description provided.
The text was updated successfully, but these errors were encountered: