-
-
Notifications
You must be signed in to change notification settings - Fork 960
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
Bilinear resampling for reprojecting DTM/DSM to custom EPSG #1340
Comments
@pierotofy -- if you point me in the direction of the relevant code, I can take a look. I've got opinions on resampling especially of elevation... . |
https://github.com/OpenDroneMap/WebODM/blob/master/app/raster_utils.py#L167 Resampling probably needs to be changed when invoked for DEMs (only), although careful, https://github.com/OpenDroneMap/WebODM/blob/master/app/raster_utils.py#L250-L259 |
Are you previewing the products in something like QGIS, or is this occurring only in WebODM's viewer? |
ArcGis Pro 3 and ODM viewer. Directly in viewer of windows I see the lines |
Yes, NN will leave artifacts in all continuous data. To your point Piero: do you have reason to isolate any patch to resampling to elevation models? Aerial imagery is continuous and would benefit from a more appropriate approach as well. It is possible that different approaches might be more appropriate for elevation models than orthophotos (likely even), but I don't know this a priori. And there may be an approach that improves both without requiring any additional logic. |
Lanczos should work well for both |
I have the concern that the resampling issues are distributed through the pipeline. I prefer Lanczos for most things most of the time: doesn't distort the location of features, compensates for the normal blurring associated with resampling with nominal sharpening, and generally does minimal distortion to statistics at most relevant scales. The problem is that Lanczos also will emphasize artifacts that are extant from early portions of the pipeline. Every time I've seen a complaint about Lanczos, the culprit was actually the addition of it to the end of a pipeline without the removal of artifacts earlier in the pipeline. So, the way I see it, we have a couple options: fix resampling everywhere it happens in WebODM and ODM, or use something like bilinear or cubic (or q1 or q3 -- never tried!) that will not emphasize and might slightly mask artifacts from earlier stages. Edit: also, I don't know if Lanczos in GDAL has been improved to better handle null values than it did previously nor how it applies to masks and transparency. |
How did you install WebODM (docker, installer, etc.)?
Native Windows installer. Running Windows 10 Pro, Version 22H2
What's your browser and operating system? (Copy/paste the output of https://www.whatismybrowser.com/)
https://whatismybrowser.com/w/TG2FBWY
What is the problem?
Vertical and horizontal lines (artefacts) in dtm/dsm data when downloading it in custom EPSG. Quite obvious when using a hillshade renderer for the dataset. I have stumbled upon this issue a couple of times outside of WebODM. It is caused by using Nearest Neighbour resampling technique when reprojecting continuous data such as terrain models.
How can we reproduce this? (What steps trigger the problem? What parameters are you using for processing? Include screenshots. If you are having issues processing a dataset, you must include a copy of your dataset uploaded on Dropbox, Google Drive or https://dronedb.app)
Selecting custom EPSG, probably a none-UTM projection, for dtm/dsm data. See screenshot below:
Recommended Solution:
I suggest to use bilinear or cubic resampling for reprojecting Terrain or Surface data when selecting a custom EPSG. It does take more time than nearest neighbour, but eliminates the artefacts. As an example, I downloaded the data from the screenshot above in native UTM projection and reprojected the dataset with bilinear resampling to my selected EPSG. Cubic resampling also works. See screenshot below:
Further reading after a quick web search, maybe not the best literature: https://gisgeography.com/raster-resampling/
The text was updated successfully, but these errors were encountered: