-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We should pansharpen with padded windows #1
Comments
I tested out @perrygeo's changes in #2 with 👎 Previous half-window approach: Shadow beneath ship👍 New approach utilizing rasterio's internal logic for determining windows, bounds and affine transforms: Shadow evenly around shipHere's a gif just for fun:Next steps:I'll look for a couple more examples to confirm this. |
Here's a quick note on running pansharpening on I noticed seams at the edge of each processing window, similar to what we observed back in July 2015: This can be fixed by make_affine function, which uses an arbitrary transformation instead of the whole-dataset affine transformation for individual windows. @perrygeo: @celoyd and I would love to learn more about how rasterio does affine transformation before we decide on ditching the |
To recap my conversation with @celoyd and @perrygeo over slack yesterday, this is the best example I can find that shows how well the new window approach implemented in #2 is able to remove the artifacts created by our current half-window approach. As seen below, the example checks out visually. I haven't found examples where the new approach introduced edge effects along the edges of each block. Let's merge this into master for now and write more unit tests that specially checks for pixel alignment after we refactor the python API: Old Half-Window Approach (assuming the panchromatic band is exactly half the resolution but otherwise aligned with RGB bands)Old Approach (red arrows) versus New Approach:More notes from our slack conversation explaining the two approaches
When we use the half-window approach, cells are no longer aligned so we would need to resample or else we would get a 7.5m shift to the NW. By aligning the affine transform when doing upsampling, we are artificially shifting the pan bands NW when really they need to be resampled. The upper left red value gets assigned to the 4 upper left pan cells: General reference on Affine transforms: http://www.perrygeo.com/python-affine-transforms.htmlcc @dnomadb |
Right now, our manually doubled affine numbers give us a slight multispectral/panchromatic offset. This isn’t a big deal today, but it’s something we should know how to handle.
We’ve used other methods in the past, but they’re prone to seams in unpredictable cases depending on pixel alignment. Per voice w/ @dnomadb, @virginiayung, @perrygeo, the most bulletproof way would look something like:
As a bonus, buffered windows would also solve the color-seam problem that would appear if we applied this code to commercial imagery.
The text was updated successfully, but these errors were encountered: