当前位置: 首页>>代码示例>>Java>>正文


Java Interpolation类代码示例

本文整理汇总了Java中javax.media.jai.Interpolation的典型用法代码示例。如果您正苦于以下问题:Java Interpolation类的具体用法?Java Interpolation怎么用?Java Interpolation使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Interpolation类属于javax.media.jai包,在下文中一共展示了Interpolation类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getBounds2D

import javax.media.jai.Interpolation; //导入依赖的package包/类
/**
    * Gets the bounding box for the output of <code>ScaleOpImage</code>.
    * This method satisfies the implementation of CRIF.
    */
   public Rectangle2D getBounds2D(ParameterBlock paramBlock) {        

       RenderableImage source = paramBlock.getRenderableSource(0);

       float scale_x = paramBlock.getFloatParameter(0);
       float scale_y = paramBlock.getFloatParameter(1);
       float trans_x = paramBlock.getFloatParameter(2);
       float trans_y = paramBlock.getFloatParameter(3);
       Interpolation interp = (Interpolation)paramBlock.getObjectParameter(4);

// Get the source dimensions
float x0 = (float)source.getMinX();
float y0 = (float)source.getMinY() ;
float w = (float)source.getWidth();
float h = (float)source.getHeight();

// Forward map the source using x0, y0, w and h
float d_x0 = x0 * scale_x + trans_x;
float d_y0 = y0 * scale_y + trans_y;
float d_w = w * scale_x;
float d_h = h * scale_y;

return new Rectangle2D.Float(d_x0, d_y0, d_w, d_h);
   }
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:29,代码来源:ScaleCRIF.java

示例2: getInterpolation

import javax.media.jai.Interpolation; //导入依赖的package包/类
private static Interpolation getInterpolation(int _interpolation){
	
	Interpolation interpolation = null;
	switch (_interpolation) {
	case 0:
		interpolation = Interpolation.getInstance(Interpolation.INTERP_NEAREST);
		break;
	case 1:
		interpolation = Interpolation.getInstance(Interpolation.INTERP_BILINEAR);
		break;
	case 2:
		interpolation = Interpolation.getInstance(Interpolation.INTERP_BICUBIC);
		break;
	default:
		interpolation = Interpolation.getInstance(Interpolation.INTERP_BILINEAR);
	}
	return interpolation;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:19,代码来源:JaiInterpolate.java

示例3: AffineBicubicOpImage

import javax.media.jai.Interpolation; //导入依赖的package包/类
/**
 * Constructs an AffineBicubicOpImage from a RenderedImage source,
 *
 * @param source a RenderedImage.
 * @param extender a BorderExtender, or null.
 * @param layout an ImageLayout optionally containing the tile grid layout,
 *        SampleModel, and ColorModel, or null.
 * @param interp an Interpolation object to use for resampling
 * @param transform the desired AffineTransform.
 */
public AffineBicubicOpImage(RenderedImage source,
                            BorderExtender extender,
                            Map config,
                            ImageLayout layout,
                            AffineTransform transform,
                            Interpolation interp,
                            double[] backgroundValues) {
    super(source,
          extender,
          config,
          layout,
          transform,
          interp,
          backgroundValues);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:26,代码来源:AffineBicubicOpImage.java

示例4: AffineBilinearOpImage

import javax.media.jai.Interpolation; //导入依赖的package包/类
/**
 * Constructs an AffineBilinearOpImage from a RenderedImage source,
 *
 * @param source a RenderedImage.
 * @param extender a BorderExtender, or null.
 * @param layout an ImageLayout optionally containing the tile grid layout,
 *        SampleModel, and ColorModel, or null.
 * @param interp an Interpolation object to use for resampling
 * @param transform the desired AffineTransform.
 */
public AffineBilinearOpImage(RenderedImage source,
                             BorderExtender extender,
                             Map config,
                             ImageLayout layout,
                             AffineTransform transform,
                             Interpolation interp,
                             double[] backgroundValues) {
    super(source,
          extender,
          config,
          layout,
          transform,
          interp,
          backgroundValues);
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:26,代码来源:AffineBilinearOpImage.java

示例5: AffineBicubic2OpImage

import javax.media.jai.Interpolation; //导入依赖的package包/类
/**
 * Constructs an AffineBicubic2OpImage from a RenderedImage source,
 *
 * @param source a RenderedImage.
 * @param extender a BorderExtender, or null.
 * @param layout an ImageLayout optionally containing the tile grid layout,
 *        SampleModel, and ColorModel, or null.
 * @param interp an Interpolation object to use for resampling
 * @param transform the desired AffineTransform.
 */
public AffineBicubic2OpImage(RenderedImage source,
                             BorderExtender extender,
                             Map config,
                             ImageLayout layout,
                             AffineTransform transform,
                             Interpolation interp,
                             double[] backgroundValues) {
    super(source,
          extender,
          config,
          layout,
          transform,
          interp,
          backgroundValues);

    subsampleBits = interp.getSubsampleBitsH();
    shiftvalue = 1 << subsampleBits;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:29,代码来源:AffineBicubic2OpImage.java

示例6: AffineGeneralOpImage

import javax.media.jai.Interpolation; //导入依赖的package包/类
/**
 * Constructs an AffineGeneralOpImage from a RenderedImage source,
 *
 * @param source a RenderedImage.
 * @param extender a BorderExtender, or null.

 * @param layout an ImageLayout optionally containing the tile grid layout,
 *        SampleModel, and ColorModel, or null.
 * @param interp an Interpolation object to use for resampling
 * @param transform the desired AffineTransform.
 */
public AffineGeneralOpImage(RenderedImage source,
                            BorderExtender extender,
                            Map config,
                            ImageLayout layout,
                            AffineTransform transform,
                            Interpolation interp,
double[] backgroundValues) {
    super(source,
          extender,
          config,
          layout,
          transform,
          interp,
   backgroundValues);

    subsampleBits = interp.getSubsampleBitsH();
    shiftvalue = 1 << subsampleBits;

    interp_width = interp.getWidth();
    interp_height = interp.getHeight();
    interp_left = interp.getLeftPadding();
    interp_top = interp.getTopPadding();
    interp_right = interp_width - interp_left - 1;
    interp_bottom = interp_height - interp_top - 1;
}
 
开发者ID:RoProducts,项目名称:rastertheque,代码行数:37,代码来源:AffineGeneralOpImage.java

示例7: create

import javax.media.jai.Interpolation; //导入依赖的package包/类
/**
 * Wrap the src coverage in the dst layout. <BR>
 * The resulting RenderedImage will contain the data in src, and will be accessible via the grid specs of dst,
 * 
 * @param src the data coverage to be remapped on dst grid
 * @param dst the provider of the final grid
 * @param nodata the nodata value to set for cells not covered by src but included in dst. All bands will share the same nodata value.
 * @return an instance of Coverage2RenderedImageAdapter
 */
public static GridCoverage2DRIA create(final GridCoverage2D src, final GridCoverage2D dst,
        final double nodata) {

    // === Create Layout
    final ImageLayout imageLayout = new ImageLayout(dst.getRenderedImage());

    //
    // SampleModel and ColorModel are related to data itself, so we
    // copy them from the source

    imageLayout.setColorModel(src.getRenderedImage().getColorModel());
    imageLayout.setSampleModel(src.getRenderedImage().getSampleModel());

    // === BorderExtender
    //
    // We have yet to check for it usefulness: it might be more convenient
    // to check for region overlapping and return a nodata value by hand,
    // so to avoid problems with interpolation at source raster borders.
    //
    BorderExtender extender = new BorderExtenderConstant(new double[] { nodata });

    return new GridCoverage2DRIA(src, dst, vectorize(src.getRenderedImage()), imageLayout,
            null, false, extender, Interpolation.getInstance(Interpolation.INTERP_NEAREST),
            new double[] { nodata });
}
 
开发者ID:geosolutions-it,项目名称:soil_sealing,代码行数:35,代码来源:GridCoverage2DRIA.java

示例8: performInternal

import javax.media.jai.Interpolation; //导入依赖的package包/类
public void performInternal (Argument args[], Context context)
        throws ExtensionException, LogoException {
    Object obj = args[0].get();
    if (obj instanceof RasterDataset) {
        RasterDataset dataset = (RasterDataset)obj;
        String newInterpolation = args[1].getString();
        if (newInterpolation.equalsIgnoreCase("NEAREST_NEIGHBOR")) {
            dataset.setInterpolation(Interpolation.INTERP_NEAREST);
        } else if (newInterpolation.equalsIgnoreCase("BILINEAR")) {
            dataset.setInterpolation(Interpolation.INTERP_BILINEAR);
        } else if (newInterpolation.equalsIgnoreCase("BICUBIC")) {
            dataset.setInterpolation(Interpolation.INTERP_BICUBIC);
        } else if (newInterpolation.equalsIgnoreCase("BICUBIC_2")) {
            dataset.setInterpolation(Interpolation.INTERP_BICUBIC_2);
        } else {
            throw new ExtensionException("Unknown interpolation type: " + Dump.logoObject(newInterpolation));
        }
    } else {
        throw new ExtensionException("not a RasterDataset: " + obj);
    }
}
 
开发者ID:reuven,项目名称:modelingcommons,代码行数:22,代码来源:RasterDataset.java

示例9: process

import javax.media.jai.Interpolation; //导入依赖的package包/类
@SuppressWarnings("nls")
@Execute
public void process() throws Exception {
    checkNull(inGeodata, pXres);
    if (pYres == null) {
        pYres = pXres;
    }
    JGTProcessingRegion region = new JGTProcessingRegion(inGeodata);
    region.setWEResolution(pXres);
    region.setNSResolution(pYres);

    GridGeometry2D newGridGeometry = region.getGridGeometry(inGeodata.getCoordinateReferenceSystem());

    Interpolation interpolation = Interpolation.getInstance(Interpolation.INTERP_NEAREST);
    if (pInterpolation.equals(BILINEAR)) {
        interpolation = Interpolation.getInstance(Interpolation.INTERP_BILINEAR);
    } else if (pInterpolation.equals(BICUBIC)) {
        interpolation = Interpolation.getInstance(Interpolation.INTERP_BICUBIC);
    }

    pm.beginTask("Resampling...", IHMProgressMonitor.UNKNOWN);
    outGeodata = (GridCoverage2D) Operations.DEFAULT.resample(inGeodata, inGeodata.getCoordinateReferenceSystem(),
            newGridGeometry, interpolation);
    pm.done();
}
 
开发者ID:TheHortonMachine,项目名称:hortonmachine,代码行数:26,代码来源:OmsRasterResolutionResampler.java

示例10: doInBackground

import javax.media.jai.Interpolation; //导入依赖的package包/类
@Override
protected Image doInBackground() throws Exception {
    RenderedImage sourceImage = FileLoadDescriptor.create(imageFilePath, null, true, null);
    int width = sourceImage.getWidth();
    int height = sourceImage.getHeight();

    float scale = (float) (targetDimension.getWidth() / width);
    scale = (float) Math.min(scale, targetDimension.getHeight() / height);
    if (scale > 1) {
        scale = 1.0f;
    }

    Interpolation interpolation = Interpolation.getInstance(Interpolation.INTERP_NEAREST);
    RenderedImage scaledImage = ScaleDescriptor.create(sourceImage,
                                                       scale, scale,
                                                       0.0f, 0.0f,
                                                       interpolation, null);
    PlanarImage planarImage = PlanarImage.wrapRenderedImage(scaledImage);
    BufferedImage bufferedImage = planarImage.getAsBufferedImage();
    planarImage.dispose();
    return bufferedImage;
}
 
开发者ID:senbox-org,项目名称:snap-desktop,代码行数:23,代码来源:ImageFileAssistantPage1.java

示例11: RasterDataAdapter

import javax.media.jai.Interpolation; //导入依赖的package包/类
public RasterDataAdapter(
		final String coverageName,
		final SampleModel sampleModel,
		final ColorModel colorModel,
		final Map<String, String> metadata,
		final int tileSize,
		final double[][] noDataValuesPerBand,
		final double[] backgroundValuesPerBand,
		final boolean buildPyramid ) {
	this(
			coverageName,
			sampleModel,
			colorModel,
			metadata,
			tileSize,
			noDataValuesPerBand,
			backgroundValuesPerBand,
			new HistogramConfig(
					sampleModel),
			true,
			Interpolation.INTERP_NEAREST,
			buildPyramid,
			new NoDataMergeStrategy());
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:25,代码来源:RasterDataAdapter.java

示例12: interpolationToByte

import javax.media.jai.Interpolation; //导入依赖的package包/类
protected static byte interpolationToByte(
		final Interpolation interpolation ) {
	// this is silly because it seems like a translation JAI should provide,
	// but it seems its not provided and its the most efficient approach
	// (rather than serializing class names)
	if (interpolation instanceof InterpolationNearest) {
		return Interpolation.INTERP_NEAREST;
	}
	if (interpolation instanceof InterpolationBilinear) {
		return Interpolation.INTERP_BILINEAR;
	}
	if (interpolation instanceof InterpolationBicubic2) {
		return Interpolation.INTERP_BICUBIC_2;
	}

	return Interpolation.INTERP_BICUBIC;
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:18,代码来源:RasterDataAdapter.java

示例13: WarpOpImage

import javax.media.jai.Interpolation; //导入依赖的package包/类
public WarpOpImage(
		RenderedImage source,
		ImageLayout layout,
		Map<?, ?> configuration,
		boolean cobbleSources,
		BorderExtender extender,
		Interpolation interp,
		Warp warp,
		double[] backgroundValues,
		ROI roi,
		Range noData ) {
	super(
			source,
			layout,
			configuration,
			cobbleSources,
			extender,
			interp,
			warp,
			backgroundValues,
			roi,
			noData);
}
 
开发者ID:locationtech,项目名称:geowave,代码行数:24,代码来源:WarpOpImage.java

示例14: resizeImage

import javax.media.jai.Interpolation; //导入依赖的package包/类
public static RenderedImage resizeImage(RenderedImage image, int width, int height)
      throws InconsistentImageScale
{
   RenderedImage resizedImage=image;
   // Computes ratio and scale
   float scale=getScale(image.getWidth(),image.getHeight(),width,height);
   
   // Processing resize process
   ParameterBlock pb = new ParameterBlock();
   // The source image
   pb.addSource(resizedImage);
   // The xScale
   pb.add(scale);
   // The yScale
   pb.add(scale);
   // The x translation
   pb.add(0.0F);
   // The y translation
   pb.add(0.0F);
   // The interpolation
   pb.add(Interpolation.getInstance(Interpolation.INTERP_BICUBIC));
   resizedImage = JAI.create("scale", pb, null);
   
   LOGGER.debug("Image resized to : " + resizedImage.getWidth() + "x"
      + resizedImage.getHeight());
   
   return resizedImage;
}
 
开发者ID:SentinelDataHub,项目名称:dhus-core,代码行数:29,代码来源:ProcessingUtils.java

示例15: populateInterpolation

import javax.media.jai.Interpolation; //导入依赖的package包/类
/**
 * Populate interpolation map.
 */
private static synchronized void populateInterpolation() {
    if (interpolationMap == null) {
        interpolationMap = new LinkedHashMap<Class<? extends Interpolation>, String>();
        interpolationMap.put(InterpolationNearest.class, "Nearest Neighbour");
        interpolationMap.put(InterpolationBicubic.class, "Bicubic");
        interpolationMap.put(InterpolationBicubic2.class, "Bicubic2");
        interpolationMap.put(InterpolationBilinear.class, "Bilinear");
    }
}
 
开发者ID:robward-scisys,项目名称:sldeditor,代码行数:13,代码来源:InterpolationValues.java


注:本文中的javax.media.jai.Interpolation类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。