Package javax.media.jai

Examples of javax.media.jai.KernelJAI


        RenderedOp src, Parameters params, int colorMapSize)
        throws MissingParameterException {

        int bitSize = numBitsToIndexColourmap(colorMapSize);

        KernelJAI kernel = getKernelFor(params, bitSize);
        IndexColorModel cm = getIndexColorModel(src, colorMapSize);
        ImageLayout layout = new ImageLayout();
        layout.setColorModel(cm);
        RenderingHints hints = new RenderingHints(JAI.KEY_IMAGE_LAYOUT, layout);
        if (src.getColorModel().getTransparency() != Transparency.OPAQUE &&
View Full Code Here


     *  range.
     */
    private KernelJAI _filterAssigner(int choice) throws IllegalActionException {
        switch (choice) {
        case _BACKDIAGONAL:
            return new KernelJAI(3, 3, _backDiagonalFilter);

        case _DIAGONAL:
            return new KernelJAI(3, 3, _diagonalFilter);

        case _FREICHEN_HORIZONTAL:
            return new KernelJAI(3, 3, _freiAndChenHorizontalFilter);

        case _FREICHEN_VERTICAL:
            return new KernelJAI(3, 3, _freiAndChenVerticalFilter);

        case _PREWITT_HORIZONTAL:
            return new KernelJAI(3, 3, _prewittHorizontalFilter);

        case _PREWITT_VERTICAL:
            return new KernelJAI(3, 3, _prewittVerticalFilter);

        case _ROBERTS_HORIZONTAL:
            return new KernelJAI(3, 3, _robertsHorizontalFilter);

        case _ROBERTS_VERTICAL:
            return new KernelJAI(3, 3, _robertsVerticalFilter);

        case _SOBEL_HORIZONTAL:
            return new KernelJAI(3, 3, _sobelHorizontalFilter);

        case _SOBEL_VERTICAL:
            return new KernelJAI(3, 3, _sobelVerticalFilter);

        case _TRANSPARENT:
            return new KernelJAI(3, 3, _transparentFilter);

        case _ZERO_FILTER:
            return new KernelJAI(3, 3, _zeroFilter);

        default:
            throw new IllegalActionException("Could not assign filter");
        }
    }
View Full Code Here

                floatArray[count] = (float) matrixValue[i][j];
                count = count + 1;
            }
        }

        return new KernelJAI(width, height, floatArray);
    }
View Full Code Here

                    floatArray[count] = (float) matrixValue[i][j];
                    count = count + 1;
                }
            }

            _filter = new KernelJAI(width, height, floatArray);
        } else {
            super.attributeChanged(attribute);
        }
    }
View Full Code Here

                    true, null ), 256, 256 );

           
            final float[] DEFAULT_KERNEL_1D = {0.25f,0.5f,0.25f};
            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

                            image =  new RenderedImageAdapter( ri );
                            originalSampleModel = image.getSampleModel();
                            originalColorModel = image.getColorModel();
                            final float[] DEFAULT_KERNEL_1D = {0.25f,0.5f,0.25f};
                            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

        int numMasks = ditherMask.length;
        this.dmask = new int[numMasks][];

        for(int k = 0; k < numMasks; k++) {
            KernelJAI mask = ditherMask[k];

            if(mask.getWidth() != dmaskWidth ||
               mask.getHeight() != dmaskHeight) {
                throw new IllegalArgumentException
                    (JaiI18N.getString("MlibOrderedDitherOpImage0"));
            }

            // Initialize the integral dither mask coefficients.
View Full Code Here

                                RenderingHints hints) {
        // Get source and parameters.
        RenderedImage source = args.getRenderedSource(0);
        LookupTableJAI colorMap =
            (LookupTableJAI)args.getObjectParameter(0);
        KernelJAI errorKernel = (KernelJAI)args.getObjectParameter(1);

        // Check colorMap compatibility.
        if(colorMap.getNumBands() != 1 &&
           colorMap.getNumBands() != 3) {
            // 1 or 3 band colorMaps only.
View Full Code Here

        RenderedImage source = args.getRenderedSource(0);

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

        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 >= 3 && kWidth <= 7 &&  kWidth == kHeight) {
            return new MlibSeparableConvolveOpImage(source,
                                                    extender, hints, layout,
                                                    kJAI);
        } else if ((kWidth == 3 && kHeight == 3) ||
                   (kWidth == 5 && kHeight == 5)) {
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 the parameters for the "Convolve" RIF.
        ParameterBlock args = new ParameterBlock(paramBlock.getSources());
        args.add(kernel);
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.