Java 渲染图像->RGB值

Java 渲染图像->RGB值,java,Java,我使用RenderImage的接口读取tif图像。 如何在2d数组中获取此图片的所有rgb值,如下所示: red[0][128] = 120; // means x=0, y=128, red value = 120 // the value 120 is the value I have to determine (and oall other rgb values)! 有人知道吗 非常感谢你的帮助 getData返回一个光栅,该光栅具有getData方法 可以调用renderImageGe

我使用RenderImage的接口读取tif图像。 如何在2d数组中获取此图片的所有rgb值,如下所示:

red[0][128] = 120; // means x=0, y=128, red value = 120
// the value 120 is the value I have to determine (and oall other rgb values)!
有人知道吗

非常感谢你的帮助

getData返回一个光栅,该光栅具有getData方法

可以调用renderImageGetData.getPixelint x,int y,int iArray[]获取RGB值吗

JavaDoc:返回指定像素的int数组中的样本。如果坐标不在边界内,可能会引发ArrayIndexOutOfBoundsException

我相信int数组返回的元素表示:红色、绿色、蓝色、Alpha和十六进制,但我不确定。

比如,我以为您想要遍历光栅,这应该可以。或者,您可以使用来获得您想要的三个乐队中的每一个

RenderedImage[] dst = new RenderedImage[3];
int[] bandIndices = new int[1];
for (int i = 0; i < 3; i++) {
    bandIndices[0] = i;
    pb = new ParameterBlock();
    pb.addSource(src);
    pb.add(bandIndices);
    dst[i] = (RenderedImage) JAI.create("bandSelect", pb);
}

是否要从左到右提取所有行并将它们存储在线性一维数组中?我想要三个二维数组:红色[]、蓝色[]和绿色[]。嗯,这不是我的问题。我不知道如何获取/访问平面图像渲染图像的rgb值。很抱歉,我原以为您要遍历二维阵列。