java.awt.image.WritableRenderedImage.getSampleModel()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(283)

本文整理了Java中java.awt.image.WritableRenderedImage.getSampleModel()方法的一些代码示例,展示了WritableRenderedImage.getSampleModel()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WritableRenderedImage.getSampleModel()方法的具体详情如下:
包路径:java.awt.image.WritableRenderedImage
类名称:WritableRenderedImage
方法名:getSampleModel

WritableRenderedImage.getSampleModel介绍

暂无

代码示例

代码示例来源:origin: Geomatys/geotoolkit

/**
 * <p>Fill destination image area from interpolation of source pixels from imageSrc.<br/>
 * Source pixel coordinates is obtained from invert transformation of destination pixel coordinates.<br/><br/>
 * - In case where interpolation equals {@linkplain InterpolationCase#LANCZOS lanczos interpolation} the default
 * choosen lanczos window is initialized by value 2.<br/>
 * - The default border comportement is define as {@link ResampleBorderComportement#FILL_VALUE}<br/>
 * - In case where pixel transformation is out of source image boundary the default choosen fill value is {@link Double#NaN}.<br/><br/>
 *
 * <strong>
 * Moreover : the specified MathTransform should be from CENTER of target image point to CENTER of source image point.<br/>
 * The used MathTransform is consider as {@link PixelInCell#CELL_CENTER} configuration.</strong></p>
 *
 * @param mathTransform Transformation use to transform target point to source point.
 * @param imageDest image will be fill by image source pixel interpolation.
 * @param imageSrc source image which contain pixel values which will be interpolate.
 * @param interpolation case of interpolation.
 * @throws NoninvertibleTransformException if it is impossible to invert {@code MathTransform} parameter.
 * @see ResampleBorderComportement
 * @see LanczosInterpolation#LanczosInterpolation(org.geotoolkit.image.iterator.PixelIterator, int)
 */
public Resample(MathTransform mathTransform, WritableRenderedImage imageDest,
    RenderedImage imageSrc, InterpolationCase interpolation) throws TransformException {
  this(mathTransform, imageDest, null, imageSrc, interpolation, 2, ResampleBorderComportement.FILL_VALUE, new double[imageDest.getSampleModel().getNumBands()]);
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * Colors an area of connected pixels with the same set of color.
 * The fill is performed in place in the given image.
 * The operation is performed immediately; it is not deferred like usual JAI operations.
 *
 * @param image     The image in which to colors an area.
 * @param oldValues The colors to replace (usually only 1 color, but more are allowed).
 * @param newValues The new colors replacing the old ones.
 * @param points    The coordinate of the starting point. There is usually only one
 *                  such point, but more are allowed.
 */
public static void fill(final WritableRenderedImage image, final double[][] oldValues,
    final double[] newValues, final Point... points)
{
  /*
   * Copies the old values in a set of SampleValues objects. The exact type of SampleValues
   * will depend on the transfer type.
   */
  final int transferType = image.getSampleModel().getTransferType();
  final Set<SampleValues> oldSamples = new HashSet<>(hashMapCapacity(oldValues.length));
  for (final double[] samples : oldValues) {
    oldSamples.add(SampleValues.getInstance(transferType, samples));
  }
  final SampleValues newSamples = SampleValues.getInstance(transferType, newValues);
  oldSamples.remove(newSamples); // Necessary for avoiding infinite loop.
  if (oldSamples.isEmpty()) {
    return;
  }
  fill(image, oldSamples::contains, newSamples, points);
}

代码示例来源:origin: Geomatys/geotoolkit

/**
 * Colors an area of connected pixels with the same set of color.
 * The fill is performed in place in the given image.
 * The operation is performed immediately; it is not deferred like usual JAI operations.
 *
 * @param image     The image in which to colors an area.
 * @param oldColors The colors to replace (usually only 1 color, but more are allowed).
 * @param newColors The new colors replacing the old ones.
 * @param points    The coordinate of the starting point. There is usually only one
 *                  such point, but more are allowed.
 */
public static void fill(final WritableRenderedImage image, final Color[] oldColors,
    final Color newColors, final Point... points)
{
  final int numBands = image.getSampleModel().getNumBands();
  final double[][] oldValues = new double[oldColors.length][];
  for (int i=0; i<oldValues.length; i++) {
    oldValues[i] = ColorUtilities.toDoubleValues(oldColors[i], numBands);
  }
  final double[] newValues = ColorUtilities.toDoubleValues(newColors, numBands);
  fill(image, oldValues, newValues, points);
}

代码示例来源:origin: apache/sis

destination = output;
if (output != null) {
  if (!input.getSampleModel().equals(output.getSampleModel())) {
    throw new IllegalArgumentException(Resources.format(Resources.Keys.MismatchedSampleModel));
  } else if (input.getMinX()   != output.getMinX()  ||

代码示例来源:origin: Geomatys/geotoolkit

|| renderedImage.getWidth()  != writableRI.getWidth()
|| renderedImage.getHeight() != writableRI.getHeight()
|| renderedImage.getSampleModel().getNumBands() != writableRI.getSampleModel().getNumBands())
throw new IllegalArgumentException("rendered image and writable rendered image dimensions are not conform.\n" +
    "First : "+renderedImage+"\nSecond : "+writableRI);

代码示例来源:origin: Geomatys/geotoolkit

if (renderedImage.getSampleModel().getNumBands() != writableRI.getSampleModel().getNumBands())
  throw new IllegalArgumentException("renderedImage and writableRenderedImage haven't got same band number");
final int riMinX   = renderedImage.getMinX();

代码示例来源:origin: Geomatys/geotoolkit

destCoords = new double[2];
this.rbc   = rbc;
this.clamp = getClamp(imageDest.getSampleModel().getDataType());

代码示例来源:origin: Geomatys/geotoolkit

this.clamp = getClamp(imageDest.getSampleModel().getDataType());

相关文章