Resampling method in the Reprojection tool

Using the “Reprojection tool”, one can select in the “Output settings” between three different resampling methods (nearest, bilinear, and bicubic). I would like to reproject and resample an RGB image. However, the output results of different resampling methods are to the pixel fully identical. The reprojection works. The resampling does not.
Any update on this issue is very welcome.

what is your source and target projection?
How did you check the similarity between different outputs?

The source dataset has no projection. Using the GCP tool I assign Lat Lon values to the file coordinates and perform the reprojection to EPSG:2056.
For the similarity check, I linked the views and compared the overall appearance on a pixel level and individual pixel values.
Since you ask, I assume having no projection in the first place might be an issue.

this is possible, because then no reprojection can be done.

the point is, the reprojection works - it is only the resampling that fails (which should be the minor issue to resolve)

I don’t understand the need for reprojection of data which has no projection :slight_smile:

Can you not just apply the Resampling operator then?

okay, a bit more clarification needed here: Yes, the data has no projection initially. But I assign a individual pixel a projection in the epsg:4326 space using the GCP manager. Using the reprojection tool, I can assign any new projection to the entire dataset (instead of a just the GCPs before). This works fine. However, the resampling associated to the reprojection tool is not working in this case.

I can confirm that the resampling is not working as it should.


In the image you can see that all three resampling methods result in the same data. And looking at the pixel values also shows identical values.

In general, the resampling should work. There are unit level tests which ensure this. So, the problem is how it is used during reprojection.
While having a quick look at the code, I saw that if the data type of a band is integer then always nearest neighbour is applied. This was probably introduced to prevent interpolation of flags and index bands, but how it is implemented is not the right way (It was me who implemented this 11 years ago :man_facepalming:t3:).
However, even for float bands always nearest neighbour is used.

I’ve created an issue for this. SNAP-1365 - In Reprojection always nearest neighbour resampling is used

Thanks for taking up the issue!

Talking about resampling. I also came to realize that the Resampling function (Raster -> Geometric operations -> Resampling) is not working properly on 8-bit RGB images (only on individual spectral bands). Particularly bright (values close to 255) and dark areas (values close to 0) in the individual bands of the RGB image are getting set to no-data in the resampled image.

Just to refine my observations. Downscaling (increasing the spatial resolution from 2 to 1 m) of individual bands works fine. But upscaling (decreasing the spatial resolution from 2 to 4 m) has issues with all interpolants.

Just an intermediate result.
After investigating this issue, it turns out that only products with pixel-based geo-conding are causing this issue. This is what you get after using the GCPs.

We are still looking into it and try to solve this soon.