I'd like to help to keep the healing tool alive.
Unfortunately I don't know the internals of Gimp,
so I probably need (a lot of) help there.

I have had a looked at the paper by T. Georgiev as cited
in app/paint/gimpheal.c

If I were to implement it directly from that paper
I'd ask the user to

- select a region which completely includes the defective
  area(s) of the image. The boundary of the selection must not
  intersect any defective parts. This selection should be
  contiguous ('simpliy connnected' in mathematical terms)
  Call this the 'destination area'.
  The current implementation seems to be restricted to
  rectangular regions. While this is far easier to handling
  for solving the Poisson equation efficiently, that's
  much too restrictive for typical usage. E.g., as Georgiev's
  paper one would select a narrow tube around a curved scratch.

- translate (i.e. move) a copy of the selection (but not
  its contents) to an area of the image serving as source
  for the healing tool. (The source region must have exactly
  the same shape as the destination area)

- a 'feather radius'

Having applied the healing tool algorithm (using the
just selected source) to a copy of the destination area
(see below) this modified copy should be 'feathered'
into the destination area where a region around the
boundary of the destination area is copied only 'randomly'

Since the requirement to include a defective area completely,
can lead to quite a large selection (e.g. for a large scratch),
the algorithm to solve the Poisson equation in the current implementation
is too slow. A trivial modification (overrelaxation) would
be significant but probably still to slow. The next better
scheme could be an SSOR-preconditioned conjugate gradient
algorithm which requires temporary storage for 3 areas of the
size of the destination area. 
If this still turns out to be too slow, it gets harder.
Multi-grid as mentioned in Georgiev's paper seems to be overkill
since it's hard to implement for (very) irregular regions.
An alternative approach using integral equations requires a 
'smooth' boundary.

Finally I don't understand what the healing tool has to do
with a 'brush' (as it is currently implemented)

A bug has been reported when source and destination areas are of
different depth. Since, IHMO, the healing tool doesn't make sense
in that case, I'd suggest to simply abort with an informative
error message.

Has anybody made experiments with the healing tool in Photoshop?
Since Georgiev is paid by Adobe I doubt he unveils all details
in his paper. Furthermore, the example given there, is a grey scale
image only. In the current implementation this algorithms is applied
to each channel (r,g,b,a) separately - is this the only alternative?

The current implementation needs an alpha channel but I don't understand
why? If the author of the current implementation isn't listing to this
mailing list, how can he/she be contacted?

Any comments and help are welcome.
I hope we can save the healing tool.


Helmut Jarausch
RWTH Aachen University, Germany

Gimp-developer mailing list

Reply via email to