Closed kevinpl07 closed 1 year ago
Hi, thank you for your interest and effort! Actually, I have some experience with pybind11 in other projects, I'm sure that you are going in the right direction.
Since in python we are likely using a Numpy array to hold an image, you can use py::array_t<uint8_t>
to pass the image to C++.
Since the element order (like row/column major) of a Numpy array can be different from the softcam's expectation, py::array::c_style
option would be useful to avoid costly memory copy and to ensure you can safely pass the pointer to softcam.
Maybe I can do the whole thing to create a python bind of softcam, by just taking half a day, and I'm happy to do that. So, I don't want to take your work, but if you are okay, I will do that.
Anyway, thanks for the great idea!
Hi @tshino,
if you are really willing to do that, that'd be amazing! I'm not that experienced with Visual Studio and C++, hence my frustration. Let me know if I could be of any assistance and thanks for your help!
Kind regards Kev
Hi @kevinpl07, I've just made it and it is already working! The code is in the branch for #13, so you can try it now.
Steps to build:
DownloadPybind11.bat
.LaunchVisualStudio.bat
in the environment.softcam.pyd
and softcam.dll
to an appropriate directory.import softcam
!I will write a detailed instruction like above as well as sample python code to use it.
Hi @tshino,
you're amazing. It works like a charm! Thank you so much for your help!
Thank you again for your post! That made this library more valuable.
Hello,
I tried creating a python binding for softcam but I can't seem to make it work.
Those are the things i looked into: Write C++ extensions for Python - Visual Studio Speeding up Python with C++ and Pybind11
Has anyone tried that or has any ideas what I could do?
Thanks in advance and best regards! Kev