[FEATURE REQUEST] ImageBuf "wrap" numpy array in python #4259
Labels
difficulty/easy
Hours-to-days for veterans, days for newcomers to the project
feature request
help wanted
A task that is desired, but needs somebody to commit the effort to implement it.
python
Python APIs
In C++, it is straightforward to construct an ImageBuf that "wraps" an existing buffer without owning the memory, where you just give it the pointer to the memory and the strides.
There's not currently an equivalent in python, but there should be! It's a great idea suggested by a question from João Vítor Silva on the slack channel. We could imagine a Python-side IB constructor that takes a numpy ndarray and knows it's just a reference to that data and not to do any copies or ownership. (With the caveat that you need to ensure that you don't change the shape or where the data lives in the numpy array, because the IB that wraps it would have no way of knowing.)
The text was updated successfully, but these errors were encountered: