I think you have the matrix laid out wrong. Instead of

  oiio.ImageBufAlgo.warp(xform, src, (1, 0, x_offset, 0, 1, y_offset, 0, 0, 1))

you want

  oiio.ImageBufAlgo.warp(xform, src, (1, 0, 0, 0, 1, 0,  x_offset, y_offset, 1))

Apologies if I steered you wrong on this.

On Feb 16, 2016, at 8:25 AM, Jep Hill <[email protected]> wrote:

Thanks Larry. 

The integer based transform worked like a charm.

The warp, however, wasn’t working as expected. I tried it in both OIIO 1.6.4dev and 1.6.10. Basically, when I enter any value other than “0� (zero) as a transform value in the matrix, I get a very dark (if not negative) image. I’ve included an example snippet:

# oiio write func from docs
def write_image(image_buffer, filename, format=oiio.UNKNOWN):
    if not image_buffer.has_error:
        image_buffer.set_write_format(format)
        image_buffer.write(filename)
    if image_buffer.has_error:
        print "Error writing %s : %s" % (filename, image_buffer.geterror())

# warp test
def warp_test(in_img, out_img, x_offset=0, y_offset=0):
    '''
    Simple warp function to test x and y transforms.
    '''
    src = "">
    xform = oiio.ImageBuf()
    oiio.ImageBufAlgo.warp(xform, src, (1, 0, x_offset, 0, 1, y_offset, 0, 0, 1))
    write_image(xform, out_img)


Is anyone able to get a simple sub-pixel x/y transform working using oiio.ImageBufAlgo.warp?

Cheers,
Jep


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

--
Larry Gritz
[email protected]


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

Reply via email to