예제 #1
0
    def __init__(self, image_a, image_b):

        self.debug = False
        self.fail_threshold = 0.1
        self.warn_threshold = 0.01

        self.image_a_buffer = ImageBuf()
        self.image_b_buffer = ImageBuf()

        # remove alpha channel from input images
        ImageBufAlgo.channels(
            self.image_a_buffer,
            ImageBuf(image_a),
            ('R', 'G', 'B')
        )
        ImageBufAlgo.channels(
            self.image_b_buffer,
            ImageBuf(image_b),
            ('R', 'G', 'B'),
        )

        # protected
        self._image_a_location = image_a
        self._image_b_location = image_b
        self._file_ext = os.path.splitext(image_a)[-1]
        self._compare_results = CompareResults()
예제 #2
0
    write(b, "black.tif")

    # fill (including use of ROI)
    b = ImageBuf(ImageSpec(256, 256, 3, oiio.UINT8))
    ImageBufAlgo.fill(b, (1, 0.5, 0.5))
    ImageBufAlgo.fill(b, (0, 1, 0), oiio.ROI(100, 180, 100, 180))
    write(b, "filled.tif")

    # checker
    b = ImageBuf(ImageSpec(256, 256, 3, oiio.UINT8))
    ImageBufAlgo.checker(b, 64, 64, 64, (1, 0.5, 0.5), (0.5, 1, 0.5), 10, 5)
    write(b, "checker.tif")

    # channels, channel_append
    b = ImageBuf()
    ImageBufAlgo.channels(b, grid, (0.25, 2, "G"))
    write(b, "chanshuffle.tif")
    b = ImageBuf()
    ImageBufAlgo.channels(b, ImageBuf("../oiiotool/src/rgbaz.exr"), ("R", "G", "B", "A"))
    write(b, "ch-rgba.exr")
    b = ImageBuf()
    ImageBufAlgo.channels(b, ImageBuf("../oiiotool/src/rgbaz.exr"), ("Z",))
    write(b, "ch-z.exr")
    b = ImageBuf()
    ImageBufAlgo.channel_append(b, ImageBuf("ch-rgba.exr"), ImageBuf("ch-z.exr"))
    write(b, "chappend-rgbaz.exr")

    # flatten
    b = ImageBuf()
    ImageBufAlgo.flatten(b, ImageBuf("../oiiotool/src/deepalpha.exr"))
    write(b, "flat.exr")
예제 #3
0
    # noise-gaussian
    b = ImageBuf(ImageSpec(64, 64, 3, oiio.UINT8))
    ImageBufAlgo.zero(b)
    ImageBufAlgo.noise(b, "gaussian", 0.5, 0.1)
    write(b, "noise-gauss.tif")

    # noise-gaussian
    b = ImageBuf(ImageSpec(64, 64, 3, oiio.UINT8))
    ImageBufAlgo.zero(b)
    ImageBufAlgo.noise(b, "salt", 1, 0.01)
    write(b, "noise-salt.tif")

    # channels, channel_append
    b = ImageBuf()
    ImageBufAlgo.channels(b, grid, (0.25, 2, "G"))
    write(b, "chanshuffle.tif")
    b = ImageBuf()
    ImageBufAlgo.channels(b, ImageBuf("../oiiotool/src/rgbaz.exr"),
                          ("R", "G", "B", "A"))
    write(b, "ch-rgba.exr")
    b = ImageBuf()
    ImageBufAlgo.channels(b, ImageBuf("../oiiotool/src/rgbaz.exr"), ("Z", ))
    write(b, "ch-z.exr")
    b = ImageBuf()
    ImageBufAlgo.channel_append(b, ImageBuf("ch-rgba.exr"),
                                ImageBuf("ch-z.exr"))
    write(b, "chappend-rgbaz.exr")

    # flatten
    b = ImageBuf()
예제 #4
0
                           roi=ROI(0, 64, 0, 64, 0, 1, 0, 3))
    write(b, "noise-uniform3.tif", oiio.UINT8)

    # noise-gaussian
    b = ImageBufAlgo.noise("gaussian",
                           0.5,
                           0.1,
                           roi=ROI(0, 64, 0, 64, 0, 1, 0, 3))
    write(b, "noise-gauss.tif", oiio.UINT8)

    # noise-gaussian
    b = ImageBufAlgo.noise("salt", 1, 0.01, roi=ROI(0, 64, 0, 64, 0, 1, 0, 3))
    write(b, "noise-salt.tif", oiio.UINT8)

    # channels, channel_append
    b = ImageBufAlgo.channels(grid, (0.25, 2, "G"))
    write(b, "chanshuffle.tif")
    b = ImageBufAlgo.channels(
        ImageBuf(OIIO_TESTSUITE_ROOT + "/oiiotool/src/rgbaz.exr"),
        ("R", "G", "B", "A"))
    write(b, "ch-rgba.exr")
    b = ImageBufAlgo.channels(
        ImageBuf(OIIO_TESTSUITE_ROOT + "/oiiotool/src/rgbaz.exr"), ("Z", ))
    write(b, "ch-z.exr")
    b = ImageBufAlgo.channel_append(ImageBuf("ch-rgba.exr"),
                                    ImageBuf("ch-z.exr"))
    write(b, "chappend-rgbaz.exr")

    # flatten
    b = ImageBufAlgo.flatten(
        ImageBuf(OIIO_TESTSUITE_ROOT + "/oiiotool-deep/src/deepalpha.exr"))
    write (b, "checker.tif", oiio.UINT8)

    # noise-uniform
    b = ImageBufAlgo.noise ("uniform", 0.25, 0.75, roi=ROI(0,64,0,64,0,1,0,3))
    write (b, "noise-uniform3.tif", oiio.UINT8)

    # noise-gaussian
    b = ImageBufAlgo.noise ("gaussian", 0.5, 0.1, roi=ROI(0,64,0,64,0,1,0,3));
    write (b, "noise-gauss.tif", oiio.UINT8)

    # noise-gaussian
    b = ImageBufAlgo.noise ("salt", 1, 0.01, roi=ROI(0,64,0,64,0,1,0,3));
    write (b, "noise-salt.tif", oiio.UINT8)

    # channels, channel_append
    b = ImageBufAlgo.channels (grid, (0.25,2,"G"))
    write (b, "chanshuffle.tif")
    b = ImageBufAlgo.channels (ImageBuf("../oiiotool/src/rgbaz.exr"),
                               ("R","G","B","A"))
    write (b, "ch-rgba.exr")
    b = ImageBufAlgo.channels (ImageBuf("../oiiotool/src/rgbaz.exr"), ("Z",))
    write (b, "ch-z.exr")
    b = ImageBufAlgo.channel_append (ImageBuf("ch-rgba.exr"),
                                     ImageBuf("ch-z.exr"))
    write (b, "chappend-rgbaz.exr")

    # flatten
    b = ImageBufAlgo.flatten (ImageBuf("../oiiotool-deep/src/deepalpha.exr"))
    write (b, "flat.exr")

    # deepen