For integer offsets, I think you can just change the current data window 
offset, and then just re-crop to the original window?  I think from Python it 
would look like:

    b = ImageBuf("blah.exr")
    orig_roi = b.roi()
    b.specmod().x += xoffset
    b.specmod().y += yoffset
    # N.B. the x,y origin is one of the few things that's safe to change
    # in an existing ImageBuf's spec. Don't try that with width or height!!
    c = ImageBuf()
    ImageBufAlgo.crop (c, b, orig_roi)
    # now c is your offset image

For sub-pixel transforms, you'd need to use warp, right:

    b = ImageBuf("blah.exr")
    c = ImageBuf()
    ImageBufAlgo.warp (c, b, (1, 0, xoffset, 0, 1, yoffset, 0, 0, 1))

The warp will be done with proper filtering, and will be more expensive, than 
the integer offset shift.

I haven't tried either of these, so take with a grain of salt and double check 
that I haven't inserted any typos or used the wrong function names or something.


> On Feb 12, 2016, at 10:04 AM, Jep Hill <[email protected]> wrote:
> 
> Hi everyone,
> 
> I'm guessing the answer is right in front of me in the docs and I'm just 
> missing it but...
> 
> Is there a way to do a 2d transform using the OIIO Python API? In this case, 
> I'm looking for an integer based reposition to avoid filtering but I'm sure 
> I'll need sub-pixel transforms in the future. I saw the warp option but I 
> thought there might be a better solution?
> 
> Cheers,
> Jep
> 
> 

--
Larry Gritz
[email protected]


_______________________________________________
Oiio-dev mailing list
[email protected]
http://lists.openimageio.org/listinfo.cgi/oiio-dev-openimageio.org

Reply via email to