Stacking (merging) images of different wavelengths

Hello everyone,

For a research project we downloaded Landsat satellite images. These images come in different bands (different wavelengths). See this site for some more information:

We chose to use 4 bands (red, green, blue, Near infrared), which means that for our analysis I have to stack those 4 images (merge them into 1 image). The way how I did that was to use the GroupBy node. The 4 images are in a table and then the images are grouped together using the aggregation method ‘merge image’. The result is 1 image. So far so good I thought, but when I compared this image with earlier research which we conducted in Python (using Rasterio), the image is different. Whereas the image in python looks much more like a combination of the 4 images, the image that KNIME produces looks very much identical to images nr. 1 and 2, but very different from images nr. 3 and 4.

This leads me to wonder if I did something wrong in KNIME. It seems like a easy operation that is very suitable for the groupby node. The goal thus is to stack images of different wave lengths in KNIME.

Kind regards,

Wouter

Hi @WouterH1985,

Have you tried to use the Merger node? According to your description, this might be the node that you are looking for.

Best regards,
Stefan

Dear Stefan,

Thank you for your reply.

I also experimented with the merger node. I transposed the table (rows to columns), but then in the merger node I got confused about what to fill in as the result dimensions and the result dimension names. What I did was X,Y as result dimension and X,Y as result dimension name, but after reading the documentation I did not quite understand what this means in the context of merging images The resulting images will have more dimensions as X and Y I presumed, but how to notate this I do not know.

Anyway, with X and Y as values I got a similar result as the groupby node (by similar I mean when I looked at the image in the image viewer), which is very different from the Python result. Perhaps this is due to me using the wrong result dimensions?

Kind regards,
Wouter

Hi Wouter,

For the Result dimension names you’ll basically have to add the name of the dimension into which the individual images should be merged. In general, you can call the dimension anyway you like, for instance Frequency. But Channel is used for visualization purposes implicitly, so you should give that a try for starters.

In the Result dimensions, you have to define the first few dimensions of the output stack. If you know, for instance, that your individual images are 1024px * 2048px and you have 3 of those, you can say 1024,2048 and the resulting image will be 1024px * 2048px * 3channels. If you are certain that all your input images have the same size, you can also define it as X,Y and KNIME will automatically figure out the numbers and insert it for you:

How did to measure this? Is this an observation based on visual appearance or pixel values in the individual channels?

Best,
Stefan

1 Like

Dear Stefan,

Thanks for very much for your reply. Turned out that in a node before I used the wrong pixel type, which led to a conversion of all pixel values. That is why the comparison with Python did not go well. It is solved, this topic can be closed.

Gr Wouter

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.