javax.media.jai.Histogram.getNumBands()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(118)

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

Histogram.getNumBands介绍

暂无

代码示例

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

private static javax.media.jai.Histogram mergeHistograms(
  final javax.media.jai.Histogram histogram1,
  final javax.media.jai.Histogram histogram2) {
 final int numBands = Math.min(histogram1.getNumBands(), histogram2.getNumBands());
 final double[] lowValue1 = histogram1.getLowValue();
 final double[] lowValue2 = histogram2.getLowValue();

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

final int numBands = histogram.getNumBands();
final float[][] cdFeq = new float[numBands][];
final double[][] computedExtrema = new double[2][numBands];

代码示例来源:origin: bcdev/beam

@Test
public void testMinMaxBinsLogHistogram() throws Exception {
  StxFactory factory = new StxFactory();
  factory
      .withMinimum(0.1)
      .withMaximum(10)
      .withLogHistogram(true)
      .withHistogramBins(new int[]{1, 2, 3, 6, 6, 3, 2, 1});
  Stx stx = factory.create();
  assertNotNull(stx.getHistogram());
  assertEquals(1, stx.getHistogram().getNumBands());
  assertEquals(8, stx.getHistogram().getNumBins()[0]);
  assertEquals(0.1, stx.getMinimum(), 1e-10);
  assertEquals(10, stx.getMaximum(), 1e-10);
  assertEquals(Math.pow(10.0, stx.getHistogram().getMean()[0]), stx.getMean(), 1e-3);
  assertEquals(Math.pow(10.0, 0), stx.getMedian(), 1e-3);
  assertEquals(-1.0, stx.getHistogram().getLowValue(0), 1e-10);
  assertEquals(1.0, stx.getHistogram().getHighValue(0), 1e-10);
  assertArrayEquals(new int[]{1, 2, 3, 6, 6, 3, 2, 1}, stx.getHistogramBins());
}

代码示例来源:origin: bcdev/beam

@Test
public void testMinMaxBins() throws Exception {
  StxFactory factory = new StxFactory();
  factory
      .withMinimum(-1.0)
      .withMaximum(1.0)
      .withHistogramBins(new int[]{1, 2, 3, 6, 6, 3, 2, 1});
  Stx stx = factory.create();
  assertEquals(-1.0, stx.getMinimum(), 1e-10);
  assertEquals(1.0, stx.getMaximum(), 1e-10);
  assertEquals(-0.125, stx.getMean(), 1e-10);
  assertEquals(0.0, stx.getMedian(), 1e-10);
  assertNotNull(stx.getHistogram());
  assertEquals(1, stx.getHistogram().getNumBands());
  assertEquals(8, stx.getHistogram().getNumBins()[0]);
  assertEquals(-1.0, stx.getHistogram().getLowValue(0), 1e-10);
  assertEquals(1.0, stx.getHistogram().getHighValue(0), 1e-10);
  assertArrayEquals(new int[]{1, 2, 3, 6, 6, 3, 2, 1}, stx.getHistogramBins());
}

代码示例来源:origin: bcdev/beam

@Test
public void testMinMaxBinsLogHistogramWithNegativeMinimum() throws Exception {
  StxFactory factory = new StxFactory();
  factory
      .withMinimum(-10)
      .withMaximum(+10)
      .withLogHistogram(true)
      .withHistogramBins(new int[]{1, 2, 3, 6, 6, 3, 2, 1});
  Stx stx = factory.create();
  assertEquals(-10, stx.getMinimum(), 1e-10);
  assertEquals(+10, stx.getMaximum(), 1e-10);
  assertEquals(0.0, stx.getMean(), 1e-3);
  assertEquals(0.0, stx.getMedian(), 1e-3);
  assertNotNull(stx.getHistogram());
  assertEquals(1, stx.getHistogram().getNumBands());
  assertEquals(8, stx.getHistogram().getNumBins()[0]);
  assertEquals(-9.0, stx.getHistogram().getLowValue(0), 1e-10); // 1E-9 is the max value we handle
  assertEquals(1.0, stx.getHistogram().getHighValue(0), 1e-10);
  assertArrayEquals(new int[]{1, 2, 3, 6, 6, 3, 2, 1}, stx.getHistogramBins());
}

代码示例来源:origin: bcdev/beam

@Test
public void testMinMaxBinsIntHistogram() throws Exception {
  StxFactory factory = new StxFactory();
  factory
      .withMinimum(1)
      .withMaximum(100)
      .withIntHistogram(true)
      .withHistogramBins(new int[]{1, 2, 3, 6, 6, 3, 2, 1});
  Stx stx = factory.create();
  assertEquals(1, stx.getMinimum(), 1e-10);
  assertEquals(100, stx.getMaximum(), 1e-10);
  assertEquals(44.75, stx.getMean(), 1e-10);
  assertEquals(51.0, stx.getMedian(), 1e-10);
  assertNotNull(stx.getHistogram());
  assertEquals(1, stx.getHistogram().getNumBands());
  assertEquals(8, stx.getHistogram().getNumBins()[0]);
  assertEquals(1, stx.getHistogram().getLowValue(0), 1e-10);
  assertEquals(101, stx.getHistogram().getHighValue(0), 1e-10);
  assertArrayEquals(new int[]{1, 2, 3, 6, 6, 3, 2, 1}, stx.getHistogramBins());
}

代码示例来源:origin: bcdev/beam

@Test
public void testMinIsMax() throws Exception {
  StxFactory factory = new StxFactory();
  factory
      .withMinimum(0)
      .withMaximum(0)
      .withHistogramBins(new int[]{1000, 0, 0, 0, 0, 0, 0, 0});
  Stx stx = factory.create();
  assertEquals(0, stx.getMinimum(), 1e-10);
  assertEquals(0, stx.getMaximum(), 1e-10);
  assertEquals(0, stx.getMean(), 1e-10);
  assertEquals(0, stx.getMedian(), 1e-10);
  assertNotNull(stx.getHistogram());
  assertEquals(1, stx.getHistogram().getNumBands());
  assertEquals(8, stx.getHistogram().getNumBins()[0]);
  assertEquals(0, stx.getHistogram().getLowValue(0), 1E-10);
  assertEquals(1.0E-10, stx.getHistogram().getHighValue(0), 1E-10);
  assertTrue(stx.getHistogram().getLowValue(0) < stx.getHistogram().getHighValue(0));
  assertArrayEquals(new int[]{1000, 0, 0, 0, 0, 0, 0, 0}, stx.getHistogramBins());
}

代码示例来源:origin: bcdev/beam

@Test
public void testMinAndMaxAreTheSameVeryLargePositiveValue() throws Exception {
  double aLargePositiveValue = Double.MAX_VALUE;
  double aSlightlySmallerValue = Math.nextAfter(aLargePositiveValue, Double.NEGATIVE_INFINITY);
  StxFactory factory = new StxFactory();
  factory
      .withMinimum(aLargePositiveValue)
      .withMaximum(aLargePositiveValue)
      .withHistogramBins(new int[]{1000, 0, 0, 0, 0, 0, 0, 0});
  Stx stx = factory.create();
  assertEquals(aLargePositiveValue, stx.getMinimum(), 1e-10);
  assertEquals(aLargePositiveValue, stx.getMaximum(), 1e-10);
  assertEquals(aLargePositiveValue, stx.getMean(), 1e-10);
  assertEquals(aLargePositiveValue, stx.getMedian(), 1e-10);
  assertNotNull(stx.getHistogram());
  assertEquals(1, stx.getHistogram().getNumBands());
  assertEquals(8, stx.getHistogram().getNumBins()[0]);
  assertEquals(aSlightlySmallerValue, stx.getHistogram().getLowValue(0), 1E-10);
  assertEquals(aLargePositiveValue, stx.getHistogram().getHighValue(0), 1E-10);
  assertTrue(stx.getHistogram().getLowValue(0) < stx.getHistogram().getHighValue(0));
  assertArrayEquals(new int[]{1000, 0, 0, 0, 0, 0, 0, 0}, stx.getHistogramBins());
}

代码示例来源:origin: bcdev/beam

@Test
public void testMinAndMaxAreTheSameVeryLargeNegativeValue() throws Exception {
  double aLargeNegativeValue = -Double.MAX_VALUE;
  double aSlightlyLargerValue = Math.nextUp(aLargeNegativeValue);
  StxFactory factory = new StxFactory();
  factory
      .withMinimum(aLargeNegativeValue)
      .withMaximum(aLargeNegativeValue)
      .withHistogramBins(new int[]{1000, 0, 0, 0, 0, 0, 0, 0});
  Stx stx = factory.create();
  assertEquals(aLargeNegativeValue, stx.getMinimum(), 1e-10);
  assertEquals(aLargeNegativeValue, stx.getMaximum(), 1e-10);
  assertEquals(aLargeNegativeValue, stx.getMean(), 1e-10);
  assertEquals(aLargeNegativeValue, stx.getMedian(), 1e-10);
  assertNotNull(stx.getHistogram());
  assertEquals(1, stx.getHistogram().getNumBands());
  assertEquals(8, stx.getHistogram().getNumBins()[0]);
  assertEquals(aLargeNegativeValue, stx.getHistogram().getLowValue(0), 1E-10);
  assertEquals(aSlightlyLargerValue, stx.getHistogram().getHighValue(0), 1E-10);
  assertTrue(stx.getHistogram().getLowValue(0) < stx.getHistogram().getHighValue(0));
  assertArrayEquals(new int[]{1000, 0, 0, 0, 0, 0, 0, 0}, stx.getHistogramBins());
}

相关文章