本文整理汇总了Java中javax.media.jai.Interpolation.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java Interpolation.getInstance方法的具体用法?Java Interpolation.getInstance怎么用?Java Interpolation.getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.media.jai.Interpolation
的用法示例。
在下文中一共展示了Interpolation.getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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 });
}
示例3: 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();
}
示例4: 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;
}
示例5: getResampling
import javax.media.jai.Interpolation; //导入方法依赖的package包/类
private Interpolation getResampling(Band band) {
int resampleType = getResampleType();
if (!ProductData.isFloatingPointType(band.getDataType())) {
resampleType = Interpolation.INTERP_NEAREST;
}
return Interpolation.getInstance(resampleType);
}
示例6: createMultiLevelImage
import javax.media.jai.Interpolation; //导入方法依赖的package包/类
public static MultiLevelImage createMultiLevelImage(float[] data, int width, int height, AffineTransform affineTransform) {
//create a planarImage with the data
PlanarImage planarImage = createFloatPlanarImage(data, width, height);
//create multi-level model
DefaultMultiLevelModel multiLevelModel = new DefaultMultiLevelModel(affineTransform, width, height);
//create multi-level source
DefaultMultiLevelSource multiLevelSource= new DefaultMultiLevelSource(planarImage, multiLevelModel, Interpolation.getInstance(Interpolation.INTERP_NEAREST));
//create multi-level image
MultiLevelImage multiLevelImage = new DefaultMultiLevelImage(multiLevelSource);
return multiLevelImage;
}
示例7: RasterDataset
import javax.media.jai.Interpolation; //导入方法依赖的package包/类
/** */
public RasterDataset (GridDimensions dimensions, WritableRaster raster) {
super("RASTER");
_dimensions = dimensions;
_raster = raster;
_interpolation = Interpolation.getInstance(Interpolation.INTERP_NEAREST);
_interpArray = new double[_interpolation.getHeight()][_interpolation.getWidth()];
GISExtension.getState().datasetLoadNotify();
}
示例8: getInterpolationOverride
import javax.media.jai.Interpolation; //导入方法依赖的package包/类
public Interpolation getInterpolationOverride() {
if (!isInterpolationOverrideSet()) {
throw new IllegalStateException(
"Interpolation Override is not set for this config");
}
return Interpolation.getInstance(interpolationOverride);
}
示例9: setQuality
import javax.media.jai.Interpolation; //导入方法依赖的package包/类
public void setQuality(int qual) {
quality = qual;
// setup interpolation quality
if (qual > 1) {
logger.debug("quality q2");
interpol = Interpolation.getInstance(Interpolation.INTERP_BICUBIC);
} else if (qual == 1) {
logger.debug("quality q1");
interpol = Interpolation.getInstance(Interpolation.INTERP_BILINEAR);
} else {
logger.debug("quality q0");
interpol = Interpolation.getInstance(Interpolation.INTERP_NEAREST);
}
}
示例10: getInterpolation
import javax.media.jai.Interpolation; //导入方法依赖的package包/类
public static Interpolation getInterpolation(String interpolationString) {
int interpolation = getInterpolationType(interpolationString);
return Interpolation.getInstance(interpolation);
}
示例11: replaceBandSourceImage
import javax.media.jai.Interpolation; //导入方法依赖的package包/类
public static void replaceBandSourceImage(Band originalBand, PlanarImage planarImage) {
MultiLevelImage newMultiLevelImage = new DefaultMultiLevelImage(new DefaultMultiLevelSource(planarImage, originalBand.getMultiLevelModel(), Interpolation.getInstance(Interpolation.INTERP_NEAREST)));
originalBand.setSourceImage(S2ResamplerUtils.adjustImageToModelTransform(newMultiLevelImage, originalBand.getMultiLevelModel()));
}
示例12: getProperty
import javax.media.jai.Interpolation; //导入方法依赖的package包/类
/**
* Returns the specified property.
*
* @param name Property name.
* @param opNode Operation node.
*/
public Object getProperty(String name,
Object opNode) {
validate(name, opNode);
if(opNode instanceof RenderedOp &&
name.equalsIgnoreCase("roi")) {
RenderedOp op = (RenderedOp)opNode;
ParameterBlock pb = op.getParameterBlock();
// Retrieve the rendered source image and its ROI.
PlanarImage src = (PlanarImage)pb.getRenderedSource(0);
Object property = src.getProperty("ROI");
if (property == null ||
property.equals(java.awt.Image.UndefinedProperty) ||
!(property instanceof ROI)) {
return java.awt.Image.UndefinedProperty;
}
// Return undefined also if source ROI is empty.
ROI srcROI = (ROI)property;
if (srcROI.getBounds().isEmpty()) {
return java.awt.Image.UndefinedProperty;
}
/// This should really create a proper AffineTransform
/// and transform the ROI with it to avoid forcing
/// ROI.getAsImage to be called.
// Retrieve the transpose type and create a nearest neighbor
// Interpolation object.
TransposeType transposeType =
(TransposeType)pb.getObjectParameter(0);
Interpolation interp =
Interpolation.getInstance(Interpolation.INTERP_NEAREST);
// Return the transposed ROI.
return new ROI(JAI.create("transpose", srcROI.getAsImage(),
transposeType));
}
return java.awt.Image.UndefinedProperty;
}
示例13: setInterpolation
import javax.media.jai.Interpolation; //导入方法依赖的package包/类
/** */
public void setInterpolation (int interpolationType) {
_interpolation = Interpolation.getInstance(interpolationType);
_interpArray = new double[_interpolation.getHeight()][_interpolation.getWidth()];
}
示例14: getInterpolation
import javax.media.jai.Interpolation; //导入方法依赖的package包/类
public Interpolation getInterpolation() {
return Interpolation.getInstance(Interpolation.INTERP_NEAREST);
}
示例15: 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[] minsPerBand,
final double[] maxesPerBand,
final String[] namesPerBand,
final double[][] noDataValuesPerBand,
final double[] backgroundValuesPerBand,
final HistogramConfig histogramConfig,
final boolean equalizeHistogram,
final int interpolationType,
final boolean buildPyramid,
final RasterTileMergeStrategy<?> mergeStrategy ) {
staticInit();
this.coverageName = coverageName;
this.tileSize = tileSize;
this.sampleModel = sampleModel;
this.colorModel = colorModel;
this.metadata = metadata;
this.minsPerBand = minsPerBand;
this.maxesPerBand = maxesPerBand;
this.namesPerBand = namesPerBand;
this.noDataValuesPerBand = noDataValuesPerBand;
this.backgroundValuesPerBand = backgroundValuesPerBand;
// a null histogram config will result in histogram statistics not being
// accumulated
this.histogramConfig = histogramConfig;
this.buildPyramid = buildPyramid;
this.equalizeHistogram = equalizeHistogram;
interpolation = Interpolation.getInstance(interpolationType);
if (mergeStrategy != null) {
this.mergeStrategy = new RootMergeStrategy(
getAdapterId(),
sampleModel.createCompatibleSampleModel(
tileSize,
tileSize),
mergeStrategy);
}
else {
this.mergeStrategy = null;
}
init();
}