• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java ScaleDescriptor类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getScaledImage

import javax.media.jai.operator.ScaleDescriptor; //导入依赖的package包/类
public static BufferedImage getScaledImage(RenderedImage image, float scale) {

        RenderedOp renderedOp = ScaleDescriptor.create(image, scale, scale,
                new Float(0.0f), new Float(0.0f), Interpolation.getInstance(Interpolation.INTERP_NEAREST), null);
        return renderedOp.getRendering().getAsBufferedImage();

		/*
		ParameterBlock pb = new ParameterBlock();
		pb.addSource(image); // The source image
		pb.add((double)scale); // The xScale
		pb.add((double)scale); // The yScale
		pb.add(0.0); // The x translation
		pb.add(0.0); // The y translation
 
		RenderingHints qualityHints = new RenderingHints(RenderingHints.KEY_RENDERING,
			    RenderingHints.VALUE_RENDER_QUALITY);
		RenderedOp resizedImage = JAI.create("SubsampleAverage", pb, qualityHints);
		return resizedImage.getAsBufferedImage();
		*/
    }
 
开发者ID:mstritt,项目名称:orbit-image-analysis,代码行数:21,代码来源:TiffConverter.java


示例2: doInBackground

import javax.media.jai.operator.ScaleDescriptor; //导入依赖的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


示例3: readMasks

import javax.media.jai.operator.ScaleDescriptor; //导入依赖的package包/类
protected void readMasks() {
    File file;
    if (metadata != null) {
        try {
            String maskFileName = metadata.getMaskFileName();
            if (maskFileName != null) {
                file = productDirectory.getFile(maskFileName);
                if (file != null && file.exists()) {
                    GeoTiffProductReader reader = new GeoTiffProductReader(getReaderPlugIn());
                    Product udmProduct = reader.readProductNodes(file, null);
                    Band srcBand = udmProduct.getBandAt(0);
                    float scaleX = (float)metadata.getRasterWidth() / (float)udmProduct.getSceneRasterWidth();
                    float scaleY = (float)metadata.getRasterHeight() / (float)udmProduct.getSceneRasterHeight();
                    RenderedOp renderedOp = ScaleDescriptor.create(srcBand.getSourceImage(), scaleX, scaleY, 0.0f, 0.0f, Interpolation.getInstance(Interpolation.INTERP_NEAREST), null);
                    Band targetBand = product.addBand("unusable_data", srcBand.getDataType());
                    targetBand.setSourceImage(renderedOp);
                    FlagCoding cloudsFlagCoding = createFlagCoding(product);
                    targetBand.setSampleCoding(cloudsFlagCoding);

                    List<Mask> cloudsMasks = createMasksFromFlagCodding(product, cloudsFlagCoding);
                    for (Mask mask : cloudsMasks) {
                        product.getMaskGroup().add(mask);
                    }
                }
            }
        } catch (IOException e) {
            logger.warning(e.getMessage());
        }
    }
}
 
开发者ID:senbox-org,项目名称:s2tbx,代码行数:31,代码来源:RapidEyeReader.java


示例4: testImageWriterScale

import javax.media.jai.operator.ScaleDescriptor; //导入依赖的package包/类
/**
 * Test method tests {@link WebPWriter} with image resize options.
 *
 * @throws IOException
 *            the test fails.
 */
@Test(dataProvider = "createImagesWithScaleOptions", enabled = true)
public void testImageWriterScale(final RenderedImage image, final float xScale,
      final float yScale, final String outputName) throws IOException {
   final String extension = outputName.substring(outputName.lastIndexOf(".") + 1);

   // Scale the image.
   final RenderedOp scaledImage = ScaleDescriptor.create(image, xScale, yScale, 0f, 0f,
         Interpolation.getInstance(Interpolation.INTERP_BICUBIC_2), null);

   // get writer
   final ImageWriter imgWriter = ImageIO.getImageWritersByFormatName(extension).next();
   final ImageWriteParam imgWriteParams = new WebPWriteParam(null);
   final String testName = "ScaleOptions";
   final File file = createOutputFile(testName, outputName);
   final ImageOutputStream imageOutputStream = ImageIO.createImageOutputStream(file);
   try {
      imgWriter.setOutput(imageOutputStream);
      imgWriter.write(null, new IIOImage(scaledImage, null, null), imgWriteParams);
      final int length = (int) imageOutputStream.length();
      assertTrue(length > 0);
   } finally {
      try {
         imageOutputStream.close();
      } catch (final IOException e) {
      }
   }
}
 
开发者ID:lonnyj,项目名称:webp-imageio,代码行数:34,代码来源:WebPWriterTest.java


示例5: scale

import javax.media.jai.operator.ScaleDescriptor; //导入依赖的package包/类
public static RenderedOp scale(final RenderedImage renderedImage, final float xFactor, final float yFactor) {
  return ScaleDescriptor.create(renderedImage, xFactor, yFactor, 0.0f, 0.0f, new InterpolationNearest(), null);
}
 
开发者ID:AndreasWBartels,项目名称:libraries,代码行数:4,代码来源:ImageContainerUtilities.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java RecordingDocIdPusher类代码示例发布时间:2022-05-22
下一篇:
Java DateCache类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap