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

x33g5p2x  于2022-01-28 转载在 其他  
字(5.0k)|赞(0)|评价(0)|浏览(195)

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

Raster.getNumBands介绍

暂无

代码示例

代码示例来源:origin: geoserver/geoserver

RenderedImage ri = coverage.getRenderedImage();
Raster raster = ri.getData();
for (int band = 0; band < raster.getNumBands(); band++) {
  ps.println("Band " + band + ":");
  for (int j = raster.getMinY(); j < (raster.getMinY() + raster.getHeight()); j++) {

代码示例来源:origin: haraldk/TwelveMonkeys

@Override
public final boolean isCompatibleRaster(final Raster raster) {
  int size = raster.getSampleModel().getSampleSize(0);
  return ((raster.getTransferType() == transferType) &&
      (raster.getNumBands() == 2) && ((1 << size) >= icm.getMapSize()));
}

代码示例来源:origin: haraldk/TwelveMonkeys

protected final int getNumBands(final IIOImage image) {
  return image.hasRaster() ? image.getRaster().getNumBands() : image.getRenderedImage().getSampleModel().getNumBands();
}

代码示例来源:origin: geotools/geotools

final Color[][] colors,
  final RenderingHints hints) {
final GridSampleDimension[] dst = new GridSampleDimension[raster.getNumBands()];
create(
    name,

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

int[] ar = new int[raster.getNumBands()];
for (int y = 0; y < image.getHeight(); ++y)

代码示例来源:origin: haraldk/TwelveMonkeys

int numBands = srcChannel.getNumBands();
if (numBands == 4 && (header.getAttributeBits() == 0 || extensions != null && !extensions.hasAlpha())) {

代码示例来源:origin: haraldk/TwelveMonkeys

final int numChannels = raster.getNumBands();
final int[] channelMax = new int[numChannels];
for (int k = 0; k < numChannels; k++) {

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

int numSrcComponents = src.getNumBands();
boolean srcHasAlpha = (numSrcComponents > numSrcColorComponents);
ColorSpace dstColorSpace = dstColorModel.getColorSpace();
int numDstColorComponents = dstColorModel.getNumColorComponents();
int numDstComponents = dstIn.getNumBands();
boolean dstHasAlpha = (numDstComponents > numDstColorComponents);

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

if (raster.getNumBands() == 4)
else if (raster.getNumBands() == 3)

代码示例来源:origin: haraldk/TwelveMonkeys

final int bands = src.getNumBands();
final int dataType = src.getTransferType();

代码示例来源:origin: haraldk/TwelveMonkeys

final int bands = src.getNumBands();
final int dataType = src.getTransferType();

代码示例来源:origin: nativelibs4java/JavaCL

static void checkSinglePixelPackedSampleModel(Raster raster) {
  if (raster.getNumDataElements() != 1)
    throw new IllegalArgumentException("Raster has " + raster.getNumBands() + " data elements, should have only 1 !");
  
  //SampleModel sampleModel = raster.getSampleModel();
  //if (!(sampleModel instanceof SinglePixelPackedSampleModel))
  //	throw new IllegalArgumentException("Expected SinglePixelPackedSampleModel, got " + sampleModel.getClass().getName());
  
  //return (SinglePixelPackedSampleModel)sampleModel;
}
static <DB extends DataBuffer> DB checkDataBuffer(Raster raster, Class<DB> dbType) {

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

/**
 * Creates a new dimension initialized to the dimension of the given raster.
 *
 * @param raster The raster from which to fetch the dimensions.
 */
public ImageDimension(final Raster raster) {
  super(raster.getWidth(), raster.getHeight());
  numBands = raster.getNumBands();
  dataType = raster.getDataBuffer().getDataType();
}

代码示例来源:origin: locationtech/geowave

private static NoDataSummary getNoDataSummary(
  final double[][] allNoDataValues,
  final Geometry shape,
  final Raster data) {
 return getNoDataSummary(
   allNoDataValues,
   new SingleShape(shape),
   new SingleRaster(data),
   data.getWidth(),
   data.getHeight(),
   data.getNumBands());
}

代码示例来源:origin: io.scif/scifio

@Override
public boolean isCompatibleRaster(final Raster raster) {
  return raster.getNumBands() == getNumComponents() &&
    raster.getTransferType() == getTransferType();
}

代码示例来源:origin: ome/formats-bsd

@Override
public boolean isCompatibleRaster(Raster raster) {
 return raster.getNumBands() == getNumComponents() &&
  raster.getTransferType() == getTransferType();
}

代码示例来源:origin: scifio/scifio

@Override
public boolean isCompatibleRaster(final Raster raster) {
  return raster.getNumBands() == getNumComponents() &&
    raster.getTransferType() == getTransferType();
}

代码示例来源:origin: com.thelastcheck.commons/tlc-commons-base

public static RenderedImage binarize(RenderedImage image) {
  if (image.getData().getNumBands() > 1)
    image = grayscale(image);
  return binarize(image, getBinarizationThreshold(image));
}

代码示例来源:origin: com.thelastcheck.commons/tlc-commons-base

public static RenderedImage grayscale(RenderedImage image) {
  if (image.getData().getNumBands() == 1)
    return image;
  // a lot of sample code uses the following instead of 1/3
  // double[][] matrix = { { 0.114, 0.587, 0.299, 0 } };
  final double[][] matrix1 = { { 1. / 3, 1. / 3, 1. / 3, 0 } };
  ParameterBlock pb1 = getParameterBlockForImage(image);
  pb1.add(matrix1);
  return JAI.create("bandcombine", pb1, null);
}

代码示例来源:origin: com.thelastcheck.commons/tlc-commons-base

public static RenderedImage binarize(RenderedImage image, double threshold) {
  if (image.getData().getNumBands() > 1)
    image = grayscale(image);
  ParameterBlock pb = getParameterBlockForImage(image);
  pb.add(threshold);
  return JAI.create("binarize", pb);
}

相关文章