예제 #1
0
    write(b, "contrast-sigmoid5.tif")

    b = ImageBuf(OIIO_TESTSUITE_ROOT + "/oiiotool/src/tahoe-small.tif")
    b = ImageBufAlgo.rangecompress(b)
    write(b, "rangecompress.tif", oiio.UINT8)
    b = ImageBufAlgo.rangeexpand(b)
    write(b, "rangeexpand.tif", oiio.UINT8)

    # FIXME - colorconvert, ociolook need tests
    print("\nTesting color conversions:")
    b = make_constimage(2, 2, 4, oiio.FLOAT, (0, 0, 0, 1))
    b.setpixel(1, 0, (.25, .25, .25, 1))
    b.setpixel(0, 1, (.5, .5, .5, 1))
    b.setpixel(1, 1, (1, 1, 1, 1))
    dumpimg(b, msg="linear src=")
    r = ImageBufAlgo.colorconvert(b, "Linear", "sRGB")
    dumpimg(r, msg="to srgb =")
    r = ImageBufAlgo.colorconvert(r, "sRGB", "Linear")
    dumpimg(r, msg="back to linear =")
    # Just to test, make a matrix that halves red, doubles green,
    # adds 0.1 to blue.
    M = (0.5, 0, 0, 0, 0, 2, 0, 0, 0, 0, 1, 0, 0, 0, 0.1, 1)
    r = ImageBufAlgo.colormatrixtransform(b, M)
    dumpimg(r, msg="after *M =")

    # computePixelStats
    b = ImageBuf(OIIO_TESTSUITE_ROOT + "/oiiotool/src/tahoe-small.tif")
    stats = ImageBufAlgo.computePixelStats(b)
    print("Stats for tahoe-small.tif:")
    print("  min         = ", stats.min)
    print("  max         = ", stats.max)
예제 #2
0
def convertColor(srcBuffer, fromColor="linear", toColor="sRGB"):
    Dst = ImageBuf()
    ImageBufAlgo.colorconvert(Dst, srcBuffer, fromColor, toColor)
    threadResult.put(Dst)
    return Dst
예제 #3
0
    write (b, "contrast-sigmoid5.tif")

    b = ImageBuf ("../oiiotool/src/tahoe-small.tif")
    b = ImageBufAlgo.rangecompress (b)
    write (b, "rangecompress.tif", oiio.UINT8)
    b = ImageBufAlgo.rangeexpand (b)
    write (b, "rangeexpand.tif", oiio.UINT8)

    # FIXME - colorconvert, ociolook need tests
    print ("\nTesting color conversions:")
    b = make_constimage (2,2,4,oiio.FLOAT,(0,0,0,1))
    b.setpixel(1, 0, (.25,.25,.25,1))
    b.setpixel(0, 1, (.5,.5,.5,1))
    b.setpixel(1, 1, (1,1,1,1))
    dumpimg (b, msg="linear src=")
    r = ImageBufAlgo.colorconvert(b, "Linear", "sRGB")
    dumpimg (r, msg="to srgb =")
    r = ImageBufAlgo.colorconvert(r, "sRGB", "Linear")
    dumpimg (r, msg="back to linear =")
    # Just to test, make a matrix that halves red, doubles green,
    # adds 0.1 to blue.
    M = ( 0.5, 0, 0,   0,
          0,   2, 0,   0,
          0,   0, 1,   0,
          0,   0, 0.1, 1)
    r = ImageBufAlgo.colormatrixtransform (b, M)
    dumpimg (r, msg="after *M =")

    # computePixelStats
    b = ImageBuf ("../oiiotool/src/tahoe-small.tif")
    stats = ImageBufAlgo.computePixelStats (b)