OpenImageIO
OpenImageIO copied to clipboard
add wrap mode arg to st_warp
Is your feature request related to a problem? Please describe. The ImageBufAlgo.warp function provides the power to control the wrap mode - i.e. how to generate pixel values outside of the image's data window. However, st_warp doesn't provide this - or at least doesn't via the Python bindings.
Describe the solution you'd like Add warp mode to the ImageBufAlgo.st_warp function
Describe alternatives you've considered I was wondering about giving access to the Filter2D class in Python, or some new class which represents the combination of a filter and some other options like wrap mode. For any functions which use these options you just pass in an object holding all the option values.
Additional context While comparing warped images made by OIIO vs. Nuke, the former has darker edges, because black outside is the default for st_warp.
I think you might be onto something here. I have a couple ideas to experiment with to see if this bundling of filtering parameters can work easily.
if I find some time, I could have a play? Unless you're already on it.
If the former, what ideas do you have?
Off the top of my head, I guess it would be a class called something like FilterParameters and would need:
- filter name
- filter width
- wrap mode
is that right?
I've already got something prototyped, hopefully will get a chance to post a PR for people to look at.
I took a stab at it over the weekend, meant to post before Monday, but I discovered and fixed an unrelated bug along the way and now I'm trying to separate the bug fix from the parameter passing change.
btw, I've realised there is currently a workaround for this specifically for the "clamp" wrap mode.
You can clamp your ST map image values to half a pixel to 1 minus half a pixel.
And horizontally (the "S") half a pixel is: 0.5 / source image width and vertically (the "T") half a pixel is: 0.5 / source image height
and for "black" to work properly use "crop" with a roi 1 pixel larger than the source image's roi_full in every direction (i.e. create a 1 pixel border - of any RGBA) and then clamp to - half a pixel to 1 + half a pixel (I think. Yet to test this)