Package com.lightcrafts.mediax.jai

Examples of com.lightcrafts.mediax.jai.KernelJAI


        /* Get BorderExtender from hints if any. */
        BorderExtender extender = RIFUtil.getBorderExtenderHint(hints);

        RenderedImage source = args.getRenderedSource(0);

        KernelJAI unRotatedKernel = (KernelJAI)args.getObjectParameter(0);
        KernelJAI kJAI = unRotatedKernel.getRotatedKernel();

        int kWidth = kJAI.getWidth();
        int kHeight= kJAI.getHeight();
  int xOri   = kJAI.getXOrigin();
  int yOri   = kJAI.getYOrigin();
  int numB   = source.getSampleModel().getNumBands();

        /* mediaLib does not handle kernels with either dimension < 2. */

        if (xOri != 1 || yOri != 1 || kWidth != 3 || kHeight != 3 || numB != 1) {
      return null;
  }
    
  // check for plus and square type of kernel

  float[] kdata = kJAI.getKernelData();

  if (isBinary && isKernel3Square1(kdata) || !isBinary && isKernel3Square0(kdata)){   

      return new MlibDilate3SquareOpImage(source, extender, hints, layout);

View Full Code Here


            // E. H. Adelson, "The Laplacian pyramid as a compact image code",
            // IEEE Transactions on Communications., pp. 532-540, 1983.

            // Add the filtering operation.
            ParameterBlock pb = new ParameterBlock();
            KernelJAI kernel = new KernelJAI(DEFAULT_KERNEL_1D.length,
                                             DEFAULT_KERNEL_1D.length,
                                             DEFAULT_KERNEL_1D.length/2,
                                             DEFAULT_KERNEL_1D.length/2,
                                             DEFAULT_KERNEL_1D,
                                             DEFAULT_KERNEL_1D);
View Full Code Here

                data[i] *= -1.0;
            }
            data[data.length/2] += 2.0F;
        }

        return new KernelJAI(size, size, data);
    }
View Full Code Here

    /**
     * Implementation of "RIF" create().
     */
    public RenderedImage create(ParameterBlock paramBlock,
                                RenderingHints renderHints) {
        KernelJAI kernel = createKernel(paramBlock.getFloatParameter(0));

        return kernel == null ? paramBlock.getRenderedSource(0):
            JAI.create("convolve", paramBlock.getRenderedSource(0), kernel);
    }
View Full Code Here

        // Get BorderExtender from hints if any.
        BorderExtender extender = RIFUtil.getBorderExtenderHint(hints);

        RenderedImage source = args.getRenderedSource(0);

        KernelJAI unRotatedKernel = (KernelJAI)args.getObjectParameter(0);
        KernelJAI kJAI = unRotatedKernel.getRotatedKernel();

        int kWidth = kJAI.getWidth();
        int kHeight = kJAI.getHeight();

        // mediaLib does not handle kernels with either dimension < 2.
        if (kWidth < 2 || kHeight < 2) {
            return null;
        }

        if (kJAI.isSeparable() && (kWidth == kHeight) &&
            (kWidth == 3 || kWidth == 5 || kWidth == 7)) {
            return new MlibSeparableConvolveOpImage(source,
                                                    extender, hints, layout,
                                                    kJAI);
  } else if ((kWidth == kHeight) &&
View Full Code Here

        /* Get BorderExtender from hints if any. */
        BorderExtender extender = RIFUtil.getBorderExtenderHint(hints);

        RenderedImage source = args.getRenderedSource(0);

        KernelJAI unRotatedKernel = (KernelJAI)args.getObjectParameter(0);
        KernelJAI kJAI = unRotatedKernel.getRotatedKernel();

        int kWidth = kJAI.getWidth();
        int kHeight= kJAI.getHeight();
  int xOri   = kJAI.getXOrigin();
  int yOri   = kJAI.getYOrigin();
  int numB   = source.getSampleModel().getNumBands();

        /* mediaLib does not handle kernels with either dimension < 2. */

        if (xOri != 1 || yOri != 1 || kWidth != 3 || kHeight != 3 || numB != 1) {
      return null;
  }
    
  // check for plus and square type of kernel

  float[] kdata = kJAI.getKernelData();

  if (isBinary && isKernel3Square1(kdata) || !isBinary && isKernel3Square0(kdata)){   

      return new MlibErode3SquareOpImage(source, extender, hints, layout);

View Full Code Here

       

        // Get BorderExtender from renderHints if any.
        BorderExtender extender = RIFUtil.getBorderExtenderHint(renderHints);

        KernelJAI unRotatedKernel =
            (KernelJAI)paramBlock.getObjectParameter(0);
        KernelJAI kJAI = unRotatedKernel.getRotatedKernel();

  RenderedImage source = paramBlock.getRenderedSource(0);
  SampleModel sm = source.getSampleModel();

  // check dataType and binary
View Full Code Here

       

        // Get BorderExtender from renderHints if any.
        BorderExtender extender = RIFUtil.getBorderExtenderHint(renderHints);

        KernelJAI unRotatedKernel =
            (KernelJAI)paramBlock.getObjectParameter(0);
        KernelJAI kJAI = unRotatedKernel.getRotatedKernel();

  RenderedImage source = paramBlock.getRenderedSource(0);
  SampleModel sm = source.getSampleModel();

  // check dataType and binary
View Full Code Here

        // Get BorderExtender from renderHints if any.
        BorderExtender extender = RIFUtil.getBorderExtenderHint(renderHints);

  // map the input kernel + gain factor to an equivalent
  // convolution kernel and then do a normal convolve.
  KernelJAI unRotatedKernel =
    ImageUtil.getUnsharpMaskEquivalentKernel(
      (KernelJAI)paramBlock.getObjectParameter(0),
      paramBlock.getFloatParameter(1));

        KernelJAI kJAI = unRotatedKernel.getRotatedKernel();

  RenderedImage source = paramBlock.getRenderedSource(0);
        int dataType = source.getSampleModel().getDataType();

        boolean dataTypeOk = (dataType == DataBuffer.TYPE_BYTE  ||
                              dataType == DataBuffer.TYPE_SHORT ||
                              dataType == DataBuffer.TYPE_INT);

        if ((kJAI.getWidth()   == 3) && (kJAI.getHeight()  == 3) &&
            (kJAI.getXOrigin() == 1) && (kJAI.getYOrigin() == 1) && dataTypeOk) {
            return new Convolve3x3OpImage(source,
                                          extender,
                                          renderHints,
                                          layout,
                                          kJAI);
        } else if (kJAI.isSeparable()) {
           return new SeparableConvolveOpImage(source,
                                               extender,
                                               renderHints,
                                               layout,
                                               kJAI);
View Full Code Here

            dataV = new float[height];
            Arrays.fill(dataV, 1.0F/(float)height);
        }

        // Construct a separable kernel.
        KernelJAI kernel = new KernelJAI(width, height, xOrigin, yOrigin,
                                         dataH, dataV);

        // Construct and return the OpImage.
        return new SeparableConvolveOpImage(paramBlock.getRenderedSource(0),
                                            extender,
View Full Code Here

TOP

Related Classes of com.lightcrafts.mediax.jai.KernelJAI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.