GNOME Bugzilla – Bug 630028
Improvement of the healing tool
Last modified: 2012-05-03 14:33:09 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
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.
Thanks Jean Can you provide before-and-after images for your patch please?
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.
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.
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.
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.
Created attachment 179285 [details] [review] Refreshed patch for master Refreshed patch against master
Bug 600393 isn't reproducible here with current git master + patch for healing improvement.
Finished code has very high priority, but getting 2.8 out has higher priority right now. Moving to 2.10 milestone
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.
*** Bug 600393 has been marked as a duplicate of this bug. ***
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.
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