def _open(self, source, size=3):
        erode = ImageBuf(source.spec())
        ImageBufAlgo.erode(erode, source, size, size)
        dilate = ImageBuf(source.spec())
        ImageBufAlgo.dilate(dilate, erode, size, size)

        return dilate
Beispiel #2
0
    # convolve -- test with bspline blur
    b = ImageBufAlgo.convolve(
        ImageBuf(OIIO_TESTSUITE_ROOT + "/oiiotool/src/tahoe-small.tif"),
        bsplinekernel)
    write(b, "bspline-blur.tif", oiio.UINT8)

    # median filter
    b = ImageBufAlgo.median_filter(
        ImageBuf(OIIO_TESTSUITE_ROOT + "/oiiotool/src/tahoe-small.tif"), 5, 5)
    write(b, "tahoe-median.tif", oiio.UINT8)

    # Dilate/erode
    undilated = ImageBuf(OIIO_TESTSUITE_ROOT + "/oiiotool/src/morphsource.tif")
    b = ImageBufAlgo.dilate(undilated, 3, 3)
    write(b, "dilate.tif", oiio.UINT8)
    b = ImageBufAlgo.erode(undilated, 3, 3)
    write(b, "erode.tif", oiio.UINT8)
    undilated = None

    # unsharp_mask
    b = ImageBufAlgo.unsharp_mask(
        ImageBuf(OIIO_TESTSUITE_ROOT + "/oiiotool/src/tahoe-small.tif"),
        "gaussian", 3.0, 1.0, 0.0)
    write(b, "unsharp.tif", oiio.UINT8)

    # unsharp_mark with median filter
    b = ImageBufAlgo.unsharp_mask(
        ImageBuf(OIIO_TESTSUITE_ROOT + "/oiiotool/src/tahoe-small.tif"),
        "median", 3.0, 1.0, 0.0)
    write(b, "unsharp-median.tif", oiio.UINT8)
Beispiel #3
0
                          bsplinekernel)
    write(b, "bspline-blur.tif", oiio.UINT8)

    # median filter
    b = ImageBuf()
    ImageBufAlgo.median_filter(b, ImageBuf("../oiiotool/src/tahoe-small.tif"),
                               5, 5)
    write(b, "tahoe-median.tif", oiio.UINT8)

    # Dilate/erode
    b = ImageBuf()
    undilated = ImageBuf("../oiiotool/src/morphsource.tif")
    ImageBufAlgo.dilate(b, undilated, 3, 3)
    write(b, "dilate.tif", oiio.UINT8)
    b = ImageBuf()
    ImageBufAlgo.erode(b, undilated, 3, 3)
    write(b, "erode.tif", oiio.UINT8)
    undilated = None

    # unsharp_mask
    b = ImageBuf()
    ImageBufAlgo.unsharp_mask(b, ImageBuf("../oiiotool/src/tahoe-small.tif"),
                              "gaussian", 3.0, 1.0, 0.0)
    write(b, "unsharp.tif", oiio.UINT8)

    # unsharp_mark with median filter
    b = ImageBuf()
    ImageBufAlgo.unsharp_mask(b, ImageBuf("../oiiotool/src/tahoe-small.tif"),
                              "median", 3.0, 1.0, 0.0)
    write(b, "unsharp-median.tif", oiio.UINT8)
Beispiel #4
0
                           bsplinekernel)
    write (b, "bspline-blur.tif", oiio.UINT8)

    # median filter
    b = ImageBuf()
    ImageBufAlgo.median_filter (b, ImageBuf("../oiiotool/src/tahoe-small.tif"),
                                5, 5)
    write (b, "tahoe-median.tif", oiio.UINT8)

    # Dilate/erode
    b = ImageBuf()
    undilated = ImageBuf("../oiiotool/src/morphsource.tif")
    ImageBufAlgo.dilate (b, undilated, 3, 3)
    write (b, "dilate.tif", oiio.UINT8)
    b = ImageBuf()
    ImageBufAlgo.erode (b, undilated, 3, 3)
    write (b, "erode.tif", oiio.UINT8)
    undilated = None

    # unsharp_mask
    b = ImageBuf()
    ImageBufAlgo.unsharp_mask (b, ImageBuf("../oiiotool/src/tahoe-small.tif"),
                               "gaussian", 3.0, 1.0, 0.0)
    write (b, "unsharp.tif", oiio.UINT8)

    # unsharp_mark with median filter
    b = ImageBuf()
    ImageBufAlgo.unsharp_mask (b, ImageBuf("../oiiotool/src/tahoe-small.tif"),
                               "median", 3.0, 1.0, 0.0)
    write (b, "unsharp-median.tif", oiio.UINT8)
    write (bsplinekernel, "bsplinekernel.exr")

    # convolve -- test with bspline blur
    b = ImageBufAlgo.convolve (ImageBuf("../oiiotool/src/tahoe-small.tif"),
                               bsplinekernel)
    write (b, "bspline-blur.tif", oiio.UINT8)

    # median filter
    b = ImageBufAlgo.median_filter (ImageBuf("../oiiotool/src/tahoe-small.tif"), 5, 5)
    write (b, "tahoe-median.tif", oiio.UINT8)

    # Dilate/erode
    undilated = ImageBuf("../oiiotool/src/morphsource.tif")
    b = ImageBufAlgo.dilate (undilated, 3, 3)
    write (b, "dilate.tif", oiio.UINT8)
    b = ImageBufAlgo.erode (undilated, 3, 3)
    write (b, "erode.tif", oiio.UINT8)
    undilated = None

    # unsharp_mask
    b = ImageBufAlgo.unsharp_mask (ImageBuf("../oiiotool/src/tahoe-small.tif"),
                                   "gaussian", 3.0, 1.0, 0.0)
    write (b, "unsharp.tif", oiio.UINT8)

    # unsharp_mark with median filter
    b = ImageBufAlgo.unsharp_mask (ImageBuf("../oiiotool/src/tahoe-small.tif"),
                                   "median", 3.0, 1.0, 0.0)
    write (b, "unsharp-median.tif", oiio.UINT8)

    # laplacian
    b = ImageBufAlgo.laplacian (ImageBuf("../oiiotool/src/tahoe-tiny.tif"))