Package javax.media.jai

Examples of javax.media.jai.KernelJAI


    /**
     * 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 renderHints if any.
        BorderExtender extender = RIFUtil.getBorderExtenderHint(renderHints);

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

        int dataType =
           paramBlock.getRenderedSource(0).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(paramBlock.getRenderedSource(0),
                                          extender,
                                          renderHints,
                                          layout,
                                          kJAI);
        } else if (kJAI.isSeparable()) {
           return new SeparableConvolveOpImage(paramBlock.getRenderedSource(0),
                                               extender,
                                               renderHints,
                                               layout,
                                               kJAI);
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

       

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

                                         StringBuffer msg) {
        if (!super.validateParameters(args, msg)) {
            return false;
        }

        KernelJAI h_kernel = (KernelJAI)args.getObjectParameter(0);
        KernelJAI v_kernel = (KernelJAI)args.getObjectParameter(1);

        /* Check if both kernels are equivalent in terms of dimensions. */
        if ((h_kernel.getWidth() != v_kernel.getWidth()) ||
            (h_kernel.getHeight() != v_kernel.getHeight())) {
            msg.append(getName() + " " +
                       JaiI18N.getString("GradientMagnitudeDescriptor1"));
                       return false;
        }
       
View Full Code Here

      System.out.println("filtrage");
      ArrayList<Raster> filteredImages = new ArrayList<Raster>();
      BorderExtender extender = BorderExtender.createInstance(BorderExtender.BORDER_REFLECT);
      for(int j = 0; j < kernelList.size(); j++){
       
        KernelJAI kernel = kernelList.get(j);
         ParameterBlock pb = new ParameterBlock();
          pb.addSource(gray);
          pb.add(kernel.getWidth()/2);
          pb.add(kernel.getHeight()/2);
          pb.add(kernel.getWidth()/2);
          pb.add(kernel.getHeight()/2);
          pb.add(extender);
          PlanarImage temp =  JAI.create("border", pb);

          PlanarImage filtered = JAI.create("convolve", temp, kernel);
         
          pb = new ParameterBlock();
          pb.addSource(filtered);
          pb.add(-kernel.getWidth()/2);
          pb.add(-kernel.getHeight()/2);
          pb.add(-kernel.getWidth()/2);
          pb.add(-kernel.getHeight()/2);
          pb.add(extender);
         
          PlanarImage result = JAI.create("border", pb);
         
          //absolute
View Full Code Here

   
    kernelList = new ArrayList<KernelJAI>();
    for(int i=0;i<filter_size.length;i++){
      for(int j=0;j<filter_ori.length;j++){
//        GaborFilter f = new GaborFilter(filter_size[i],filter_ori[j],sigmas[i],lambdas[i]);
        kernelList.add(new KernelJAI(filter_size[i], filter_size[i], GaborFilterFactory.getGaborFilter(filter_size[i], filter_ori[j], sigmas[i], lambdas[i])));
      }
    }
  }
View Full Code Here

      System.out.println("filtrage");
      ArrayList<Raster> filteredImages = new ArrayList<Raster>();
      BorderExtender extender = BorderExtender.createInstance(BorderExtender.BORDER_REFLECT);
      for(int j = 0; j < kernelList.size(); j++){

        KernelJAI kernel = kernelList.get(j);
        ParameterBlock pb = new ParameterBlock();
        pb.addSource(gray);
        pb.add(kernel.getWidth()/2);
        pb.add(kernel.getHeight()/2);
        pb.add(kernel.getWidth()/2);
        pb.add(kernel.getHeight()/2);
        pb.add(extender);
        PlanarImage temp =  JAI.create("border", pb);

        PlanarImage filtered = JAI.create("convolve", temp, kernel);

        pb = new ParameterBlock();
        pb.addSource(filtered);
        pb.add(-kernel.getWidth()/2);
        pb.add(-kernel.getHeight()/2);
        pb.add(-kernel.getWidth()/2);
        pb.add(-kernel.getHeight()/2);
        pb.add(extender);

        PlanarImage result = JAI.create("border", pb);
        //absolute
        result = AbsoluteDescriptor.create(result, null);
View Full Code Here

   
    kernelList = new ArrayList<KernelJAI>();
    for(int i=0;i<filter_size.length;i++){
      for(int j=0;j<filter_ori.length;j++){
//        GaborFilter f = new GaborFilter(filter_size[i],filter_ori[j],sigmas[i],lambdas[i]);
        kernelList.add(new KernelJAI(filter_size[i], filter_size[i], GaborFilterFactory.getGaborFilter(filter_size[i], filter_ori[j], sigmas[i], lambdas[i])));
      }
    }
  }
View Full Code Here

/* 51 */     ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
/*    */
/* 54 */     RenderedImage source = paramBlock.getRenderedSource(0);
/* 55 */     LookupTableJAI lookupTable = (LookupTableJAI)paramBlock.getObjectParameter(0);
/*    */
/* 57 */     KernelJAI kernel = (KernelJAI)paramBlock.getObjectParameter(1);
/*    */
/* 59 */     return new ErrorDiffusionOpImage(source, renderHints, layout, lookupTable, 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.