Posted by
Gabriel Landini on
Jun 14, 2008; 11:07pm
URL: http://imagej.273.s1.nabble.com/chromatic-aberattion-tp3695678p3695683.html
On Saturday 14 June 2008 18:38:59 Tomáš Procházka wrote:
> In image still exist purple/violet fringe.
I see. I looked around and I found this interesting page:
http://ray.cg.tuwien.ac.at/rft/Photography/TipsAndTricks/Aberration/which suggests 2 things:
1. expand rather than shrink the planes (so one avoids the loss of image at
the borders). In this case we expand the green channel rather than shrinking
the red and blue.
2. desaturating the edges
The macro below tries those ideas and does a fairly decent job on the bicycle
image you posted.
// Colour Aberration Correction
setBatchMode(true);
a=getTitle();
run("RGB Stack");
setSlice(2);
run("Scale...", "x=1.00081 y=1.00081 interpolate");
run("RGB Color");
run("HSB Stack");
setSlice(3);
run("Duplicate...", "title=edges");
run("Exp");
run("Gaussian Blur...", "sigma=5");
run("Find Edges");
run("Gaussian Blur...", "sigma=5");
run("Divide...", "value=2");
selectImage(a);
setSlice(2); //de-saturate strong edges
imageCalculator("Subtract", a,"edges");
run("RGB Color");
setBatchMode(false);
The green plane expansion, amount of desaturation and Gaussian blur radii are
completely empirical so there might be better values for these.
Perhaps the desaturation should be applied less strongly in the centre than at
the extremes of the image so a radial weighting might be more appropriate.
One can apply more desaturation, (for instance by not dividing the edges by 2)
but other parts of the image lose their colour (for instance the canopy of
the the trees in the background).
Please post back any improvements.
Regards,
Gabriel