Welcome to the BEAM Forum!

We encourage you to sign in our forum and participate in the BEAM community. The forum is maintained by the BEAM project team who will most likely answer your questions within 24 hours (except during common holidays) - if not done by other community members. Collaborate, share your knowledge and learn from other users!

If you don't find what you are looking for, please also consider the following external forums:

Combination View Flat View Tree View
Threads [ Previous | Next ]
RGB image from single band
toggle
RGB image from single band
gpf colour manipulation operator colors
10/18/13 8:13 AM
Hello,

I need to write a GPF operator that will create an RGB image (PNG format) from a single band of its input product.
So far, managed to create a greyscale image but am having no luck with extending it to have multiple colors.

From what I've understood I need a color palette, but haven't been able to figure out how to create one which will work with my test data.
(I'm testing using one of the bands in the sample product ATS_TOA_1CNPDK20030504_111259_000000572016_00080_06146_0157.N1)

Any help on how to proceed with this is really appreciated.

thanks,
kutila
Flag Flag
RE: RGB image from single band
Answer Answer (Unmark)
10/18/13 2:44 PM as a reply to Kutila Gunasekera.
Hi,

you need to create an ImageInfo.
A simple version could look like the following
1new ImageInfo(new ColorPaletteDef(new ColorPaletteDef.Point[]{
2                    new ColorPaletteDef.Point(v1, new Color(255, 0, 0)),
3                    new ColorPaletteDef.Point((v1 + v2) / 2, new Color(255, 255, 255)),
4                    new ColorPaletteDef.Point(v2, new Color(0, 0, 255)

Where v1 and v2 are min and max of a value range. You can add more points to the array to have more colours in the image.

You can use the ImageManager to create an image of the band with the ImageInfo.

If you're still having problems, just ask again.

regards
Marco
Flag Flag
RE: RGB image from single band
10/21/13 8:56 AM as a reply to Marco Peters.
Thanks Marco!

Using the ImageManager to create the image did the trick for me. Previously I was using ProductUtils.createRgbImage(...) (and quite likely didn't perform all the necessary steps).

regards,
Kutila
Flag Flag