Project

General

Profile

Bug #11862

Haze removal module adds horizontal and vertical seams, and bright colored artifacts in dark areas

Added by Sarge Borsch about 1 month ago. Updated 11 days ago.

Status:
New
Priority:
Low
Assignee:
-
Category:
Darkroom
Target version:
-
Start date:
12/17/2017
Due date:
% Done:

0%

Affected Version:
2.4.0rc1
System:
Mac OS X
bitness:
64-bit
hardware architecture:
amd64/x86

Description

I've attached screenshots (with haze removal enabled & disabled) from darkroom mode where the issue is visible, along with the affected raw image and its settings.
The colored artifacts are probably related to https://redmine.darktable.org/issues/11854 and are always present in the exported image as well.
The seams which are along X/Y axes are usually present in the exported image, and they may have varied locations, but they always look similar to the ones on the screenshot. I've marked their locations with green arrows on the screenshot.
Both issues disappear if haze removal module is disabled.
Disabling OpenCL doesn't change anything (visually at least).

Tested on macOS 10.12.6

with_haze_removal.png (3.51 MB) Sarge Borsch, 12/17/2017 08:21 AM

without_haze_removal.png (3.09 MB) Sarge Borsch, 12/17/2017 08:22 AM

IMG_0760.CR2 (17.1 MB) Sarge Borsch, 12/17/2017 08:23 AM

IMG_0760.CR2.xmp (13.3 KB) Sarge Borsch, 12/17/2017 08:24 AM

dt_log.txt Magnifier - darktable -d nan > dt_log.txt 2>&1 (11.8 KB) Sarge Borsch, 12/17/2017 09:17 PM

History

#1 Updated by Sarge Borsch about 1 month ago

Oops, I totally missed that 2.4.0rc2 was just released, I will re-test with it shortly.
--
So I tested 2.4.0rc2, both kinds of artifacts are still present, both in preview and in the exported image.

#2 Updated by Paolo Astengo about 1 month ago

I'm confirming the same behavior, but you can easily solve by applying the "defringe" iop

#3 Updated by Sarge Borsch about 1 month ago

Paolo Astengo wrote:

you can easily solve by applying the "defringe" iop

true, but it'll solve only half of the problem. (there are 2 kinds of artifacts produced)

#4 Updated by Tobias Ellinghaus about 1 month ago

Please run darktable with -d nan from a terminal and post the output.

#5 Updated by Sarge Borsch about 1 month ago

Tobias Ellinghaus wrote:

Please run darktable with -d nan from a terminal and post the output.

Done, added `dt_log.txt` with the output.

#6 Updated by Heiko Bauke about 1 month ago

Hi,

Sarge Borsch wrote:

Paolo Astengo wrote:

you can easily solve by applying the "defringe" iop

true, but it'll solve only half of the problem. (there are 2 kinds of artifacts produced)

the haze removal module should be sufficiently robust not to produce nans and numerical overflow or underflow. Nevertheless, you will always be able to produce artifacts by misusing the module.

Your example is basically haze free. Use the "distance" and "strength" sliders to reduce artifacts, i.e., reduce "distance" and/or "strength". Your picture features strong chromatic aberrations and the haze removal module seems to amplify them. Apply the chromatic aberrations module (which comes before haze removal in the pixel pipeline) or the defringe module the reduce chromatic aberrations.

Heiko

#7 Updated by Sarge Borsch about 1 month ago

Heiko Bauke wrote:

Your example is basically haze free. Use the "distance" and "strength" sliders to reduce artifacts, i.e., reduce "distance" and/or "strength". Your picture features strong chromatic aberrations and the haze removal module seems to amplify them. Apply the chromatic aberrations module (which comes before haze removal in the pixel pipeline) or the defringe module the reduce chromatic aberrations.

Heiko

Yes I understand this, but there's another problem (horizontal&vertical lines) which are surely unrelated to chromatic aberrations. It's the most troubling here.

#8 Updated by Tobias Ellinghaus about 1 month ago

Might these lines be from discontinuities at tile borders? They seem to create rectangular regions.

Edit: That was mainly a question for Heiko.

#9 Updated by Heiko Bauke about 1 month ago

Hi,

Sarge Borsch wrote:

Yes I understand this, but there's another problem (horizontal&vertical lines) which are surely unrelated to chromatic aberrations. It's the most troubling here.

the horizontal and vertical artifacts look as if they are a result of the tiled processing in the haze removal module, indeed. However, although I can see these artifacts quite clearly in your screen shot I am not able to reproduce them in darktable using your RAW file and your XMP file. This makes it somewhat difficult to debug the problem. In case that you compile darktable from the sources, try to change in the file `hazeremoval.c`

static void guided_filter_tiling(const_rgb_image imgg, gray_image img, gray_image img_out, tile target, int w,
                                 float eps)
{
  const tile source = { max_i(target.left - 2 * w, 0), min_i(target.right + 2 * w, imgg.width),
                        max_i(target.lower - 2 * w, 0), min_i(target.upper + 2 * w, imgg.height) };

to

static void guided_filter_tiling(const_rgb_image imgg, gray_image img, gray_image img_out, tile target, int w,
                                 float eps)
{
  const tile source = { max_i(target.left - 3 * w, 0), min_i(target.right + 3 * w, imgg.width),
                        max_i(target.lower - 3 * w, 0), min_i(target.upper + 3 * w, imgg.height) };

and test if the problem disappears. You can turn off tiled processing completely by setting

const int tile_width = 512 - 4 * w2;

to a value that is lager than the largest length of your RAW file.

Heiko

#10 Updated by Sarge Borsch 11 days ago

In case that you compile darktable from the sources

I'd like to, but I still did not succeed in producing a complete build (for macOS, which is unfortunately all I have right now). I've written about my troubles on the developer mailing list on 23 Dec, but there were no answers. Perhaps I should create another issue for the building troubles?

Also available in: Atom PDF