本文整理汇总了Java中javax.media.jai.InterpolationBilinear类的典型用法代码示例。如果您正苦于以下问题:Java InterpolationBilinear类的具体用法?Java InterpolationBilinear怎么用?Java InterpolationBilinear使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
InterpolationBilinear类属于javax.media.jai包,在下文中一共展示了InterpolationBilinear类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: interpolationToByte
import javax.media.jai.InterpolationBilinear; //导入依赖的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
示例2: TestWarp
import javax.media.jai.InterpolationBilinear; //导入依赖的package包/类
/**
* Creates a new TestWarp object.
*/
public TestWarp (String path)
{
srcImage = JAI.create("fileload", new ParameterBlock().add(path), null);
// srcImage = PictureLoader.loadImages(new File(path), null)
// .get(1);
// srcImage = buildPattern(20, 10, 50, 50);
dimension = new Dimension(srcImage.getWidth(), srcImage.getHeight());
setPreferredSize(dimension);
// float[] xCoeffs = new float[] { 0f, 1.25f, 0.04f };
// float[] yCoeffs = new float[] { 0f, -0.02f, 1.5f };
// Warp warp = new WarpAffine(xCoeffs, yCoeffs);
//
int xStep = 500;
int xNumCells = 2;
int yStep = 500;
int yNumCells = 1;
float[] warpPositions = new float[]{
-100f, 0f, 500f, 100f, 1000f, 0f, // top line
0f, 500f, 500f, 500f, 1000f, 500f
}; // bot line
Warp warp = new WarpGrid(0, xStep, xNumCells, 0, yStep, yNumCells, warpPositions);
ParameterBlock pb = new ParameterBlock();
pb.addSource(invert(srcImage));
pb.add(warp);
pb.add(new InterpolationBilinear());
dstImage = invert(JAI.create("warp", pb));
((PlanarImage) dstImage).getTiles();
}
开发者ID:Audiveris,项目名称:audiveris,代码行数:33,代码来源:TestWarp.java
示例3: populateInterpolation
import javax.media.jai.InterpolationBilinear; //导入依赖的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
示例4: create
import javax.media.jai.InterpolationBilinear; //导入依赖的package包/类
/**
* Creates a new instance of warp operator according to the warp object
* and interpolation method.
*
* @param paramBlock The warp and interpolation objects.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
// Get ImageLayout from renderHints if any.
ImageLayout layout = RIFUtil.getImageLayoutHint(renderHints);
// Get BorderExtender from renderHints if any.
BorderExtender extender = RIFUtil.getBorderExtenderHint(renderHints);
RenderedImage source = paramBlock.getRenderedSource(0);
Warp warp = (Warp)paramBlock.getObjectParameter(0);
Interpolation interp = (Interpolation)paramBlock.getObjectParameter(1);
double[] backgroundValues = (double[])paramBlock.getObjectParameter(2);
if (interp instanceof InterpolationNearest) {
return new WarpNearestOpImage(source,
renderHints,
layout,
warp,
interp,
backgroundValues);
} else if (interp instanceof InterpolationBilinear) {
return new WarpBilinearOpImage(source, extender, renderHints,
layout, warp, interp,
backgroundValues);
} else {
return new WarpGeneralOpImage(source, extender, renderHints,
layout, warp, interp,
backgroundValues);
}
}
开发者ID:RoProducts,项目名称:rastertheque,代码行数:39,代码来源:WarpRIF.java
示例5: create
import javax.media.jai.InterpolationBilinear; //导入依赖的package包/类
/**
* <p> Creates a new instance of SubsampleOpImage in the rendered layer.
* This method satisfies the implementation of RIF.
*
* @param paramBlock The source image, the X and Y scale factors.
* @param renderHints RenderingHints.
*/
public RenderedImage create(ParameterBlock paramBlock,
RenderingHints renderHints) {
RenderedImage source = paramBlock.getRenderedSource(0);
BorderExtender extender = renderHints == null ? null :
(BorderExtender)renderHints.get(JAI.KEY_BORDER_EXTENDER);
ImageLayout layout = renderHints == null ? null :
(ImageLayout)renderHints.get(JAI.KEY_IMAGE_LAYOUT);
int scaleX = paramBlock.getIntParameter(0);
int scaleY = paramBlock.getIntParameter(1);
float [] qsFilter = (float [])paramBlock.getObjectParameter(2);
Interpolation interp = (Interpolation)paramBlock.getObjectParameter(3);
// check if binary and interpolation type allowed
SampleModel sm = source.getSampleModel();
int dataType = sm.getDataType();
// Determine the interpolation type, if not supported throw exception
boolean validInterp = (interp instanceof InterpolationNearest) ||
(interp instanceof InterpolationBilinear) ||
(interp instanceof InterpolationBicubic) ||
(interp instanceof InterpolationBicubic2);
if (!validInterp)
throw new IllegalArgumentException(
JaiI18N.getString("FilteredSubsample3"));
return new FilteredSubsampleOpImage(source, extender, (Map)renderHints, layout,
scaleX, scaleY, qsFilter, interp);
}
开发者ID:RoProducts,项目名称:rastertheque,代码行数:39,代码来源:FilteredSubsampleRIF.java
示例6: reportInternal
import javax.media.jai.InterpolationBilinear; //导入依赖的package包/类
public Object reportInternal (Argument args[], Context context)
throws ExtensionException, LogoException {
Interpolation interp = getDataset(args[0]).getInterpolation();
if (interp instanceof InterpolationNearest) {
return "NEAREST_NEIGHBOR";
} else if (interp instanceof InterpolationBilinear) {
return "BILINEAR";
} else if (interp instanceof InterpolationBicubic) {
return "BICUBIC";
} else if (interp instanceof InterpolationBicubic2) {
return "BICUBIC_2";
} else {
throw new ExtensionException("Unknown interpolation type: " + Dump.logoObject(interp));
}
}
开发者ID:reuven,项目名称:modelingcommons,代码行数:16,代码来源:RasterDataset.java
示例7: dewarpImage
import javax.media.jai.InterpolationBilinear; //导入依赖的package包/类
public RenderedImage dewarpImage ()
{
ParameterBlock pb = new ParameterBlock();
pb.addSource(Picture.invert(sheet.getPicture().getImage()));
pb.add(dewarpGrid);
pb.add(new InterpolationBilinear());
RenderedImage dewarpedImage = Picture.invert(JAI.create("warp", pb));
((PlanarImage) dewarpedImage).getTiles();
return dewarpedImage;
}
开发者ID:jlpoolen,项目名称:libreveris,代码行数:13,代码来源:JaiDewarper.java
示例8: TestWarp
import javax.media.jai.InterpolationBilinear; //导入依赖的package包/类
/**
* Creates a new TestWarp object.
*/
public TestWarp (String path)
{
srcImage = JAI.create("fileload", new ParameterBlock().add(path), null);
// srcImage = PictureLoader.loadImages(new File(path), null)
// .get(1);
// srcImage = buildPattern(20, 10, 50, 50);
dimension = new Dimension(srcImage.getWidth(), srcImage.getHeight());
setPreferredSize(dimension);
// float[] xCoeffs = new float[] { 0f, 1.25f, 0.04f };
// float[] yCoeffs = new float[] { 0f, -0.02f, 1.5f };
// Warp warp = new WarpAffine(xCoeffs, yCoeffs);
//
int xStep = 500;
int xNumCells = 2;
int yStep = 500;
int yNumCells = 1;
float[] warpPositions = new float[] {
-100f, 0f, 500f, 100f, 1000f, 0f, // top line
0f, 500f, 500f, 500f, 1000f, 500f
}; // bot line
Warp warp = new WarpGrid(
0,
xStep,
xNumCells,
0,
yStep,
yNumCells,
warpPositions);
ParameterBlock pb = new ParameterBlock();
pb.addSource(invert(srcImage));
pb.add(warp);
pb.add(new InterpolationBilinear());
dstImage = invert(JAI.create("warp", pb));
((PlanarImage) dstImage).getTiles();
}
开发者ID:jlpoolen,项目名称:libreveris,代码行数:40,代码来源:TestWarp.java
示例9: FilteredSubsampleOpImage
import javax.media.jai.InterpolationBilinear; //导入依赖的package包/类
/** <p> <code>FilteredSubsampleOpImage</code> constructs an OpImage representing
* filtered integral subsampling. The scale factors represent the ratio of
* source to destination dimensions.
*
* @param source a RenderedImage.
* @param extender a BorderExtender, or null.
* @param config a Map object possibly holding tile cache information
* @param layout an ImageLayout optionally containing the tile grid layout,
* SampleModel, and ColorModel, or null.
* @param interp a Interpolation object to use for resampling.
* @param scaleX downsample factor along x axis.
* @param scaleY downsample factor along y axis.
* @param qsFilter symmetric filter coefficients (partial kernel).
* @throws IllegalArgumentException if the interp type is not one of:
* INTERP_NEAREST, INTERP_BILINEAR, INTERP_BICUBIC, or INTERP_BICUBIC_2
*/
public FilteredSubsampleOpImage(RenderedImage source,
BorderExtender extender,
Map config,
ImageLayout layout,
int scaleX,
int scaleY,
float [] qsFilter,
Interpolation interp) {
// Propagate to GeometricOpImage constructor
super(vectorize(source),
layoutHelper(source, interp, scaleX, scaleY, qsFilter.length, layout),
config, // Map object
true, // cobbleSources,
extender, // extender
interp, // Interpolation object
null);
int resampleType;
// Determine the interpolation type, if not supported throw exception
if (interp instanceof InterpolationNearest) {
resampleType = Interpolation.INTERP_NEAREST;
} else if (interp instanceof InterpolationBilinear) {
resampleType = Interpolation.INTERP_BILINEAR;
} else if (interp instanceof InterpolationBicubic) {
resampleType = Interpolation.INTERP_BICUBIC;
} else if (interp instanceof InterpolationBicubic2) {
resampleType = Interpolation.INTERP_BICUBIC_2;
} else {
throw new IllegalArgumentException(
JaiI18N.getString("FilteredSubsample3"));
}
// Construct combined anti-alias and resample kernels.
this.hParity = filterParity(scaleX,resampleType);
this.vParity = filterParity(scaleY,resampleType);
this.hKernel = combineFilters(scaleX,resampleType,qsFilter);
this.vKernel = combineFilters(scaleY,resampleType,qsFilter);
this.scaleX = scaleX;
this.scaleY = scaleY;
}
开发者ID:RoProducts,项目名称:rastertheque,代码行数:62,代码来源:FilteredSubsampleOpImage.java
示例10: validateParameters
import javax.media.jai.InterpolationBilinear; //导入依赖的package包/类
/**
* Validates the input parameters.
*
* <p> In addition to the standard checks performed by the
* superclass method, this method checks that "scaleX" and "scaleY"
* are both greater than 0 and that the interpolation type
* is one of 4 standard types: <br>
* <p> <code>
* javax.media.jai.InterpolationNearest <br>
* javax.media.jai.InterpolationBilinear <br>
* javax.media.jai.InterpolationBicubic <br>
* javax.media.jai.InterpolationBicubic2
* </code>
*/
protected boolean validateParameters(String modeName,
ParameterBlock args,
StringBuffer msg) {
if (!super.validateParameters(modeName, args, msg))
return false;
int scaleX = args.getIntParameter(0);
int scaleY = args.getIntParameter(1);
if (scaleX < 1 || scaleY < 1) {
msg.append(getName() + " " +
JaiI18N.getString("FilteredSubsampleDescriptor1"));
return false;
}
float[] filter = (float[])args.getObjectParameter(2);
// if this parameter is null, generate the kernel based on the
// procedure described above.
if (filter == null) {
int m = scaleX > scaleY ? scaleX: scaleY;
if ((m & 1) == 0)
m++;
double sigma = (m - 1) / 6.0;
// when m is 1, sigma is 0; will generate NaN. Give any number
// to sigma will generate the correct kernel {1.0}
if (m == 1)
sigma = 1.0;
filter = new float[m/2 + 1];
float sum = 0;
for (int i = 0; i < filter.length; i++) {
filter[i] = (float)gaussian((double)i, sigma);
if (i == 0)
sum += filter[i];
else
sum += filter[i] * 2;
}
for (int i = 0; i < filter.length; i++) {
filter[i] /= sum;
}
args.set(filter, 2);
}
Interpolation interp = (Interpolation)args.getObjectParameter(3);
// Determine the interpolation type, if not supported throw exception
if (!((interp instanceof InterpolationNearest) ||
(interp instanceof InterpolationBilinear) ||
(interp instanceof InterpolationBicubic) ||
(interp instanceof InterpolationBicubic2))) {
msg.append(getName() + " " +
JaiI18N.getString("FilteredSubsampleDescriptor2"));
return false;
}
return true;
}
开发者ID:RoProducts,项目名称:rastertheque,代码行数:77,代码来源:FilteredSubsampleDescriptor.java
注:本文中的javax.media.jai.InterpolationBilinear类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论