Bug report #6561

'cubic' resambling for "zoomed in" (scale > 100%) rasters creates undesired visual glitches with contrast set to stretch to min max

Added by Mathieu Pellerin - nIRV over 11 years ago. Updated about 5 years ago.

Status:Closed
Priority:Normal
Assignee:Marco Hugentobler
Category:Rasters
Affected QGIS version:master Regression?:No
Operating System:all Easy fix?:No
Pull Request or Patch supplied:No Resolution:end of life
Crashes QGIS or corrupts data:No Copied to github as #:15761

Description

Steps to reproduce visual glitches:

1. Load a raster; for the sake of this example, please use 1:10m ocean bottom available @ http://www.naturalearthdata.com/downloads/10m-raster-data/10m-ocean-bottom/ as it shows this issue quite well
2. In the layer property window, retrieve the min/max values of RGB bands with these settings:
() cumulative count cut 2 - 98%
(
) Full (extend)
(*) Estimate (faster) (accurary)
3. Set contrast enhancement to "Stretch to MinMax"
4. Set zoomed in resampling to "Cubic"
5. Apply the change, then zoom in (raster zoom scale must be > 100% to activate cubic resampling) a region of the raster (if using the above ocean bottom raster, glitches easily to spot in southern china sea, among other places)

You'll notice weird visual glitches which are not there if using the two other types of resambling. I'm attaching a screenshot of the problem.

qgis-raster-resampling-visualglitch.jpg (347 KB) Mathieu Pellerin - nIRV, 2012-10-23 12:48 AM

resampling-comparison.jpg (351 KB) Mathieu Pellerin - nIRV, 2012-10-29 06:54 PM

Associated revisions

Revision a1b858b8
Added by Nyall Dawson about 9 years ago

[raster] Fix cubic resampler visual glitches (refs #6561)

Resampler was not correctly bounding color components for premultiplied
image format. There's still errors in the resampled raster at the
source image edges and glitches with transparency channels, though.

Also fix a bunch of inefficiencies in the code.

History

#1 Updated by Marco Hugentobler over 11 years ago

If the image has sharp changes, it is in the nature of cubic functions to overshoot. I think this is what you perceive as visual glitches. In that cases, using cubic interpolation is just not suitable.

#2 Updated by Mathieu Pellerin - nIRV over 11 years ago

Marco, I understand the characteristic cubic interpolation, and I believe what is being raised here doesn't fall within expected results of a cubic resampling :)

I'm attaching a new screenshot that compares the three available resampling methods for raster >100%, including the problematic cubic one. It'll hopefully help better demonstrate the issue.

#3 Updated by Radim Blazek almost 11 years ago

  • Assignee changed from Radim Blazek to Marco Hugentobler

#4 Updated by Jürgen Fischer almost 10 years ago

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

#5 Updated by Médéric RIBREUX over 8 years ago

  • Status changed from Open to Feedback

Hello, bug triage...

I can't reproduce it on QGIS 2.13 master . Can you confirm ?

#6 Updated by Nyall Dawson over 8 years ago

It's still an issue - as per the commit note above, it's now only visible on image edges.

#7 Updated by Nyall Dawson over 8 years ago

  • Status changed from Feedback to Open

#8 Updated by Giovanni Manghi almost 7 years ago

  • Regression? set to No
  • Easy fix? set to No

#9 Updated by Giovanni Manghi about 5 years ago

  • Resolution set to end of life
  • Status changed from Open to Closed

Also available in: Atom PDF