After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 630028 - Improvement of the healing tool
Improvement of the healing tool
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: Tools
git master
Other All
: Normal enhancement
: 2.8
Assigned To: GIMP Bugs
GIMP Bugs
: 600393 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2010-09-18 23:36 UTC by Jean Yves
Modified: 2012-05-03 14:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Ready to use patch for gimpheal.c from version 2.6.10 (7.65 KB, application/octet-stream)
2010-09-18 23:36 UTC, Jean Yves
  Details
Cleaned up patch set against master (7.78 KB, patch)
2010-09-19 10:35 UTC, Michael Natterer
needs-work Details | Review
What the current healing tool does (233.90 KB, image/jpeg)
2010-09-20 06:01 UTC, Jean Yves
  Details
What the proposed modified healing tool does (197.06 KB, image/jpeg)
2010-09-20 06:04 UTC, Jean Yves
  Details
Patch against 2.6.10 with updated comments (10.13 KB, patch)
2010-10-03 22:28 UTC, Jean Yves
none Details | Review
Refreshed patch for master (11.13 KB, patch)
2011-01-25 11:51 UTC, Nelson A. de Oliveira
none Details | Review

Description Jean Yves 2010-09-18 23:36:17 UTC
Created attachment 170572 [details]
Ready to use patch for gimpheal.c from version 2.6.10

Hi,

I don't think the healing brush tool performs the way it should in 2.6.10 and onwards. My proposed method makes it closer to the results you get with Photoshop.

I have changed the algorithm quite a bit as the proposed relighting invariant method was not giving proper results.
The method used here is similar but slightly different: we do not divide the RGB components, but substract them:
I2 = I0 - I1, where I0 is the sample image to be corrected, I1 is the reference pattern. 
Then we solve DeltaI=0 (Laplace) with I2 Dirichlet conditions at the borders of the mask. The solver is a slightly optimized Gauss-Siedel with an over-relaxation factor of 1.8. It can benefit from a multi-grid evaluation of an initial solution before the main iteration loop. I reduced the convergence criteria to .1% (0.001) as we are dealing here with RGB integer components, more is overkill. It would probably work with 1...
Then the final image is I3 = I + I1.
I've tried to add luminance correction to provide pixel per pixel invariance but the result was awful.

Attached is the diff -rup patch file from stable version 2.6.10

Jean Yves
Comment 1 Michael Natterer 2010-09-19 10:35:49 UTC
Created attachment 170586 [details] [review]
Cleaned up patch set against master

Thanks, this sounds great. I have not tried it, but I have applied
the patch to git master and cleaned it up to match the coding style.

Now we need somebody to try the patch and carefully compare the results
to the old heal method.
Comment 2 Martin Nordholts 2010-09-19 11:37:39 UTC
Thanks Jean

Can you provide before-and-after images for your patch please?
Comment 3 Jean Yves 2010-09-20 06:01:36 UTC
Created attachment 170628 [details]
What the current healing tool does

This is a capture of what the healing tool currently does. Note the color distortion. The patch was applied on the lower right corner of the image using the lower left corner as a reference brush.
Comment 4 Jean Yves 2010-09-20 06:04:33 UTC
Created attachment 170629 [details]
What the proposed modified healing tool does

This is what my proposed healing tool does. The colors are matched which is usually what you want when you try to repair a damaged picture.
Comment 5 Sven Neumann 2010-09-27 19:02:50 UTC
Review of attachment 170586 [details] [review]:

Comments should be changed to explain the current code and not refer to the old code. People reading this code are not interested in what the code used to do. Also the unused function should be removed entirely if it isn't needed any longer.

With these changes the change should go into master, in my opinion.
Comment 6 Jean Yves 2010-10-03 22:28:54 UTC
Created attachment 171651 [details] [review]
Patch against 2.6.10 with updated comments

Here's an updated patch that cleans up the comments. It's against 2.6.10 and should be re-run against the master. There are some additional modifications between the original 2.6.10 and the current master in git that I did not port. They need to be ported manually.
Comment 7 Nelson A. de Oliveira 2011-01-25 11:51:58 UTC
Created attachment 179285 [details] [review]
Refreshed patch for master

Refreshed patch against master
Comment 8 Nelson A. de Oliveira 2011-02-22 18:26:02 UTC
Bug 600393 isn't reproducible here with current git master + patch for healing improvement.
Comment 9 Martin Nordholts 2011-03-14 07:52:53 UTC
Finished code has very high priority, but getting 2.8 out has higher priority right now. Moving to 2.10 milestone
Comment 10 Serge Gavrilov 2011-10-16 07:08:44 UTC
I use this patch during one year without any problems. The healing tool becomes to be much more useful. I confirm that bug #600393 is not reproducible with the patch. Please, consider this to include into 2.8.
Comment 11 Michael Natterer 2011-10-17 19:48:11 UTC
*** Bug 600393 has been marked as a duplicate of this bug. ***
Comment 12 Michael Natterer 2011-10-17 19:51:03 UTC
Ok guys, I'm convinced. The old stuff was obviously b0rk.

commit f92df81a47da588986c69e36bdf82aa6335559be
Author: Michael Natterer <mitch@gimp.org>
Date:   Mon Oct 17 21:47:01 2011 +0200

    Bug 630028 - Improvement of the healing tool
    
    Apply patch from Jean-Yves Couleaud that replaces the heal algorithm
    with one that actually works. After trying some images, I don't just
    consider this an "improvement" any longer, the old code was obviously
    broken, or an early prototype, or whatever.
Comment 13 Miroslav Talasek 2012-05-03 14:33:09 UTC
this is not good solution , old works better for me, for human skin, the New one kill target color and work like clone tool, it is unusable for retouch skin 
u can see on my test example: 
http://photo.talasek.sk/special/healtool.tar.bz2 

the names of layer suggest what does it mean 
old version works perfectly