Package javax.media.jai

Examples of javax.media.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


        /* 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

       

        RenderedImage source = paramBlock.getRenderedSource(0);
        LookupTableJAI lookupTable =
            (LookupTableJAI)paramBlock.getObjectParameter(0);
        KernelJAI kernel = (KernelJAI)paramBlock.getObjectParameter(1);

        return new ErrorDiffusionOpImage(source, renderHints, layout,
                                         lookupTable, kernel);
    }
View Full Code Here

        /*
         * Get the Horizontal & Vertical kernels.
         * At this point these kernels should have the same width & height
         */
        KernelJAI kern_h = (KernelJAI)args.getObjectParameter(0);
        KernelJAI kern_v = (KernelJAI)args.getObjectParameter(1);

        /* Get the width & height of the kernels. */
        int kWidth = kern_h.getWidth();
        int kHeight = kern_v.getHeight();

        /* Check and see if the operation is a Sobel. */
        float khdata[], kvdata[];
        khdata = kern_h.getKernelData();
        kvdata = kern_v.getKernelData();
        if ((khdata[0] == -1.0F && khdata[1] == -2.0F && khdata[2] == -1.0F &&
             khdata[3] ==  0.0F && khdata[4] ==  0.0F && khdata[5] ==  0.0F &&
             khdata[6] ==  1.0F && khdata[7] ==  2.0F && khdata[8] ==  1.0F) &&
            (kvdata[0] == -1.0F && kvdata[1] == 0.0F && kvdata[2] == 1.0F &&
             kvdata[3] == -2.0F && kvdata[4] == 0.0F && kvdata[5] == 2.0F &&
View Full Code Here

      newData[k] = -gain * oldData[k];

  k = yOrigin*width + xOrigin;
  newData[k] = 1.0f + gain * (1.0f - oldData[k]);

  return new KernelJAI(width, height, xOrigin, yOrigin, newData);
    }
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

        BorderExtender extender = RIFUtil.getBorderExtenderHint(renderHints);
       
        RenderedImage source = paramBlock.getRenderedSource(0);

        // Get the Horizontal & Vertical kernels
        KernelJAI kern_h = (KernelJAI)paramBlock.getObjectParameter(0);
        KernelJAI kern_v = (KernelJAI)paramBlock.getObjectParameter(1);
       
        return new GradientOpImage(source,
                                   extender,
                                   renderHints,
                                   layout,
View Full Code Here

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

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

TOP

Related Classes of javax.media.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.