Color Arithmetic in Java

I'm trying to parse some Landsat images, when you browse online image merging algorithms, I found one of the special interests that I'm trying to realize. I have 3 algorithms that are already implemented, and they are great, but I can't get it to work.

I have the following code:

int red1 = ((redImage.getRGB(x, y)>>> 16) & 0xFF);
int green1 = ((greenImage.getRGB(x, y)>>> 8) & 0xFF);
int blue1 = ((blueImage.getRGB(x, y)) & 0xFF);

Gets the red, green, and blue values ​​of the red, green, and blue images, respectively. I also have the following code:

int pan1 = ((panImage.getRGB(x, y)>>> 16) & 0xFF);
int pan2 = ((panImage.getRGB(x, y)>>> 8) & 0xFF);
int pan3 = ((panImage.getRGB(x, y)) & 0xFF);

This code retrieves the red, green, and blue values ​​of a single panchromatic image. This has nothing to do with the problem, but its value should be just in case.

, , , , . , :

int red = red1 * pan1;
int green = green1 * pan2;
int blue = blue1 * pan3;

int rgb = ((red << 16) | (green << 8) | blue);

colouredImage.setRGB(x, y, (rgb | 0xFF000000));

, - , .. , . , , , .

, , - , , - -, ?

.

+3
1

. red1 * pan1, 0 ... 255.

:

[0...1]

0.0 ... 1.0. , . 0 ... 255, .

255

. 255. , . , , .

int red = (red1 * pan1) / 255;
// same for other colors
+3

All Articles