Package javax.media.jai

Examples of javax.media.jai.InterpolationNearest


    pb.addSource(pi); // The source image
    pb.add(factor); // The xScale
    pb.add(factor); // The yScale
    pb.add(0.0F); // The x translation
    pb.add(0.0F); // The y translation
    pb.add(new InterpolationNearest()); // The interpolation
    // Create the scale operation
    return (JAI.create("scale", pb, null));
  }
View Full Code Here


    assertNotNull(image);
    assertNotNull(PlanarImage.wrapRenderedImage(image));
    assertTrue(image.getColorModel() instanceof IndexColorModel);
   
    // nearest
                image = renderer.renderImage(gc, rs, new InterpolationNearest(), null, 256, 256);
                assertNotNull(image);
                assertNotNull(PlanarImage.wrapRenderedImage(image));
                assertTrue(image.getColorModel() instanceof IndexColorModel);   
   
   
View Full Code Here

        // scale if/as needed. Also check if the scale expands the coverage dimension for at least 1 pixel.
        //
        ////
        if (scaleFactor != null && (Math.abs(coverageWidth*(scaleFactor - 1f)) >=1 || Math.abs(coverageHeight*(scaleFactor - 1f)) >= 1) ) {
            // Selection of the interpolation parameter
            Interpolation interp = interpolation != null ? interpolation : new InterpolationNearest();
            // Selection of the ScaleFactors in order to check if the final Raster has almost 1 pixel for Height and Width
            double scaleX = scaleFactor;
            double scaleY = scaleFactor;
            // RenderedImage associated to the coverage
            final RenderedImage imageToBescaled = gc2d.getRenderedImage();
View Full Code Here

        finalRaster2Model.concatenate(decimationScaleTranform);

      // keep into account translation factors to place this tile
      finalRaster2Model.preConcatenate((AffineTransform) worldToGrid);
     
      final InterpolationNearest nearest = new InterpolationNearest();
      //paranoiac check to avoid that JAI freaks out when computing its internal layouT on images that are too small
      Rectangle2D finalLayout= ImageUtilities.layoutHelper(
          raster,
          (float)finalRaster2Model.getScaleX(),
          (float)finalRaster2Model.getScaleY(),
View Full Code Here

                pb.addSource(image);
                pb.add(scaleX);
                pb.add(scaleY);
                pb.add(translateX);
                pb.add(translateY);
                pb.add(new InterpolationNearest());

                image = JAI.create("scale", pb);
                log.log(image, query.getRasterId(), "03_scale");

                int width = image.getWidth();
View Full Code Here

            break
          case Bicubic:
            newImage = Utils.subsample(currentImage,baseTC,new InterpolationBicubic(2),downsampleStep,borderExtender);
            break;
          case Nearest:
            newImage = Utils.subsample(currentImage,baseTC, new InterpolationNearest(),downsampleStep,borderExtender);
            break;           
          default:
            throw new IllegalArgumentException("Invalid scaling algorithm "+scaleAlgorithm);//cannot get here
           
          }
View Full Code Here

      final ParameterBlockJAI pb = new ParameterBlockJAI("filteredsubsample");
      pb.addSource(src);
      pb.setParameter("scaleX", new Integer(downsampleStep));
      pb.setParameter("scaleY", new Integer(downsampleStep));
      pb.setParameter("qsFilterArray", lowPassFilter);
      pb.setParameter("Interpolation", new InterpolationNearest());
      return JAI.create("filteredsubsample", pb,newHints);
    }
View Full Code Here

    catch (IllegalArgumentException e) {
      indexOfBorderExtenderParam=-1;
    }

    final Interpolation interpolation =(Interpolation) (indexOfInterpolationParam==-1?
          new InterpolationNearest():
            parameters.parameters.getObjectParameter("interpolation")); ;
    final BorderExtender borderExtender=
      (BorderExtender) (indexOfBorderExtenderParam!=-1?
          parameters.parameters.getObjectParameter("BorderExtender"):
            ImageUtilities.DEFAULT_BORDER_EXTENDER);
View Full Code Here

        coverage = (GridCoverage2D) reader.read(null);
        // Reader disposal
        reader.dispose();

        // Definition of the interpolation type
        nearest = new InterpolationNearest();
        bilinear = new InterpolationBilinear();
        bicubic = new InterpolationBicubic(8);

        // Definition of the background values
        nodata = new double[] { 0 };
View Full Code Here

    public void testCoverageWithNearestInterp() throws MismatchedDimensionException,
            TransformException {
        // Execution of the RasterAsPointCollectionProcess setting hemisphere, scaleFactor and nearest interpolation
        boolean hemisphere = true;
        float scaleFactor = 2.0f;
        Interpolation interp = new InterpolationNearest();
        SimpleFeatureCollection collection = process.execute(coverage, null, scaleFactor, interp,
                hemisphere);
        // Check if the points are exactly as the number of pixel number
        Assert.assertEquals((int) (pixelNumber * scaleFactor * scaleFactor), collection.size());
        // Check if each Point Attribute contains the same values of the Input coverage
View Full Code Here

TOP

Related Classes of javax.media.jai.InterpolationNearest

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.