本文整理了Java中javax.media.jai.iterator.RandomIter.getPixel
方法的一些代码示例,展示了RandomIter.getPixel
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RandomIter.getPixel
方法的具体详情如下:
包路径:javax.media.jai.iterator.RandomIter
类名称:RandomIter
方法名:getPixel
暂无
代码示例来源:origin: geotools/geotools
public double[] getPixel(int x, int y, double[] dArray) {
return delegate.getPixel(x, y, dArray);
}
代码示例来源:origin: geotools/geotools
public float[] getPixel(int x, int y, float[] fArray) {
return delegate.getPixel(x, y, fArray);
}
代码示例来源:origin: geotools/geotools
public int[] getPixel(int x, int y, int[] iArray) {
return delegate.getPixel(x, y, iArray);
}
代码示例来源:origin: geotools/geotools
it.getPixel(c, r, pixel);
cursor.init(pixel);
代码示例来源:origin: geotools/geotools
for (int r = 0; r < height; r++) {
for (int c = 0; c < width; c++) {
it1.getPixel(c, r, components);
px1.init(components);
it2.getPixel(c, r, components);
px2.init(components);
代码示例来源:origin: com.googlecode.jaitools/jt-utils
private void extendAsDouble(WritableRaster raster, PlanarImage sourceImage) {
Rectangle bounds = sourceImage.getBounds();
Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1);
RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds);
double[] pixel = new double[raster.getNumBands()];
for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) {
for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) {
if (!bounds.contains(x, y)) {
samplingBounds.setLocation(x - maxDistance, y - maxDistance);
Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds);
int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x;
int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y;
srcIter.getPixel(sx, sy, pixel);
raster.setPixel(x, y, pixel);
}
}
}
}
代码示例来源:origin: org.jaitools/jt-utils
private void extendAsFloat(WritableRaster raster, PlanarImage sourceImage) {
Rectangle bounds = sourceImage.getBounds();
Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1);
RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds);
float[] pixel = new float[raster.getNumBands()];
for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) {
for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) {
if (!bounds.contains(x, y)) {
samplingBounds.setLocation(x - maxDistance, y - maxDistance);
Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds);
int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x;
int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y;
srcIter.getPixel(sx, sy, pixel);
raster.setPixel(x, y, pixel);
}
}
}
}
代码示例来源:origin: org.jaitools/jt-utils
private void extendAsInt(WritableRaster raster, PlanarImage sourceImage) {
Rectangle bounds = sourceImage.getBounds();
Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1);
RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds);
int[] pixel = new int[raster.getNumBands()];
for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) {
for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) {
if (!bounds.contains(x, y)) {
samplingBounds.setLocation(x - maxDistance, y - maxDistance);
Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds);
int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x;
int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y;
srcIter.getPixel(sx, sy, pixel);
raster.setPixel(x, y, pixel);
}
}
}
}
代码示例来源:origin: org.jaitools/jt-utils
private void extendAsDouble(WritableRaster raster, PlanarImage sourceImage) {
Rectangle bounds = sourceImage.getBounds();
Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1);
RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds);
double[] pixel = new double[raster.getNumBands()];
for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) {
for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) {
if (!bounds.contains(x, y)) {
samplingBounds.setLocation(x - maxDistance, y - maxDistance);
Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds);
int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x;
int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y;
srcIter.getPixel(sx, sy, pixel);
raster.setPixel(x, y, pixel);
}
}
}
}
代码示例来源:origin: com.googlecode.jaitools/jt-utils
private void extendAsInt(WritableRaster raster, PlanarImage sourceImage) {
Rectangle bounds = sourceImage.getBounds();
Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1);
RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds);
int[] pixel = new int[raster.getNumBands()];
for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) {
for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) {
if (!bounds.contains(x, y)) {
samplingBounds.setLocation(x - maxDistance, y - maxDistance);
Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds);
int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x;
int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y;
srcIter.getPixel(sx, sy, pixel);
raster.setPixel(x, y, pixel);
}
}
}
}
代码示例来源:origin: com.googlecode.jaitools/jt-utils
private void extendAsFloat(WritableRaster raster, PlanarImage sourceImage) {
Rectangle bounds = sourceImage.getBounds();
Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1);
RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds);
float[] pixel = new float[raster.getNumBands()];
for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) {
for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) {
if (!bounds.contains(x, y)) {
samplingBounds.setLocation(x - maxDistance, y - maxDistance);
Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds);
int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x;
int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y;
srcIter.getPixel(sx, sy, pixel);
raster.setPixel(x, y, pixel);
}
}
}
}
代码示例来源:origin: org.jaitools/jt-utils
private void extendAsByte(WritableRaster raster, PlanarImage sourceImage) {
Rectangle bounds = sourceImage.getBounds();
Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1);
RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds);
int[] pixel = new int[raster.getNumBands()];
for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) {
for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) {
if (!bounds.contains(x, y)) {
samplingBounds.setLocation(x - maxDistance, y - maxDistance);
Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds);
int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x;
int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y;
srcIter.getPixel(sx, sy, pixel);
for (int b = 0; b < raster.getNumBands(); b++) {
raster.setSample(x, y, b, pixel[b] & 0xff);
}
}
}
}
}
代码示例来源:origin: org.jaitools/jt-utils
private void extendAsUShort(WritableRaster raster, PlanarImage sourceImage) {
Rectangle bounds = sourceImage.getBounds();
Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1);
RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds);
int[] pixel = new int[raster.getNumBands()];
for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) {
for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) {
if (!bounds.contains(x, y)) {
samplingBounds.setLocation(x - maxDistance, y - maxDistance);
Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds);
int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x;
int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y;
srcIter.getPixel(sx, sy, pixel);
for (int b = 0; b < raster.getNumBands(); b++) {
raster.setSample(x, y, b, pixel[b] & 0xffff);
}
}
}
}
}
代码示例来源:origin: com.googlecode.jaitools/jt-utils
private void extendAsUShort(WritableRaster raster, PlanarImage sourceImage) {
Rectangle bounds = sourceImage.getBounds();
Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1);
RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds);
int[] pixel = new int[raster.getNumBands()];
for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) {
for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) {
if (!bounds.contains(x, y)) {
samplingBounds.setLocation(x - maxDistance, y - maxDistance);
Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds);
int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x;
int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y;
srcIter.getPixel(sx, sy, pixel);
for (int b = 0; b < raster.getNumBands(); b++) {
raster.setSample(x, y, b, pixel[b] & 0xffff);
}
}
}
}
}
代码示例来源:origin: com.googlecode.jaitools/jt-utils
private void extendAsByte(WritableRaster raster, PlanarImage sourceImage) {
Rectangle bounds = sourceImage.getBounds();
Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1);
RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds);
int[] pixel = new int[raster.getNumBands()];
for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) {
for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) {
if (!bounds.contains(x, y)) {
samplingBounds.setLocation(x - maxDistance, y - maxDistance);
Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds);
int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x;
int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y;
srcIter.getPixel(sx, sy, pixel);
for (int b = 0; b < raster.getNumBands(); b++) {
raster.setSample(x, y, b, pixel[b] & 0xff);
}
}
}
}
}
代码示例来源:origin: com.googlecode.jaitools/jt-utils
private void extendAsShort(WritableRaster raster, PlanarImage sourceImage) {
Rectangle bounds = sourceImage.getBounds();
Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1);
RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds);
int[] pixel = new int[raster.getNumBands()];
for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) {
for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) {
if (!bounds.contains(x, y)) {
samplingBounds.setLocation(x - maxDistance, y - maxDistance);
Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds);
int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x;
int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y;
srcIter.getPixel(sx, sy, pixel);
for (int b = 0; b < raster.getNumBands(); b++) {
raster.setSample(x, y, b, clamp(pixel[b], Short.MIN_VALUE, Short.MAX_VALUE));
}
}
}
}
}
代码示例来源:origin: org.jaitools/jt-utils
private void extendAsShort(WritableRaster raster, PlanarImage sourceImage) {
Rectangle bounds = sourceImage.getBounds();
Rectangle samplingBounds = new Rectangle(0, 0, 2 * maxDistance + 1, 2 * maxDistance + 1);
RandomIter srcIter = RandomIterFactory.create(sourceImage, bounds);
int[] pixel = new int[raster.getNumBands()];
for (int y = raster.getMinY(), ny = 0; ny < raster.getHeight(); y++, ny++) {
for (int x = raster.getMinX(), nx = 0; nx < raster.getWidth(); x++, nx++) {
if (!bounds.contains(x, y)) {
samplingBounds.setLocation(x - maxDistance, y - maxDistance);
Rectangle sourceSamplingBounds = samplingBounds.intersection(bounds);
int sx = rand.nextInt(sourceSamplingBounds.width) + sourceSamplingBounds.x;
int sy = rand.nextInt(sourceSamplingBounds.height) + sourceSamplingBounds.y;
srcIter.getPixel(sx, sy, pixel);
for (int b = 0; b < raster.getNumBands(); b++) {
raster.setSample(x, y, b, clamp(pixel[b], Short.MIN_VALUE, Short.MAX_VALUE));
}
}
}
}
}
代码示例来源:origin: geosolutions-it/jai-ext
/** Method for testing the selected input RandomIter on an Integral image */
public void testRandomIterInt(RenderedImage img, int[] valueArray, boolean cachedTiles,
boolean arrayCalculation) {
RandomIter iter = RandomIterFactory.create(img, null, cachedTiles, arrayCalculation);
int[] array = new int[3];
// Store of the image data calculated
for (int i = 0; i < indexArray.length; i++) {
int x = indexArray[i][0];
int y = indexArray[i][1];
int valueExpected = iter.getSample(x, y, 0);
assertEquals(valueExpected, valueArray[i]);
int valueExpectedArray = iter.getPixel(x, y, array)[0];
assertEquals(valueExpectedArray, valueArray[i]);
}
}
代码示例来源:origin: geosolutions-it/jai-ext
/** Method for testing the selected input RandomIter on a Double image */
public void testRandomIterDouble(RenderedImage img, double[] valueArray, boolean cachedTiles,
boolean arrayCalculation) {
RandomIter iter = RandomIterFactory.create(img, null, cachedTiles, arrayCalculation);
double[] array = new double[3];
// Store of the image data calculated
for (int i = 0; i < indexArray.length; i++) {
int x = indexArray[i][0];
int y = indexArray[i][1];
double valueExpected = iter.getSampleDouble(x, y, 0);
assertEquals(valueExpected, valueArray[i], DELTA);
double valueExpectedArray = iter.getPixel(x, y, array)[0];
assertEquals(valueExpectedArray, valueArray[i], DELTA);
}
}
代码示例来源:origin: geosolutions-it/jai-ext
/** Method for testing the selected input RandomIter on a Float image */
public void testRandomIterFloat(RenderedImage img, float[] valueArray, boolean cachedTiles,
boolean arrayCalculation) {
RandomIter iter = RandomIterFactory.create(img, null, cachedTiles, arrayCalculation);
float[] array = new float[3];
// Store of the image data calculated
for (int i = 0; i < indexArray.length; i++) {
int x = indexArray[i][0];
int y = indexArray[i][1];
float valueExpected = iter.getSampleFloat(x, y, 0);
assertEquals(valueExpected, valueArray[i], DELTA);
float valueExpectedArray = iter.getPixel(x, y, array)[0];
assertEquals(valueExpectedArray, valueArray[i], DELTA);
}
}
内容来源于网络,如有侵权,请联系作者删除!