The Retinex .8bf Plugin
Version 1.113, updated 12/5/2015


original plugin


Retinex image processing attempts to imitate the lightness and color perception of human vision.  The image is first mapped to a logarithmic scale, then a Gaussian blurred copy is subtracted as in unsharp masking.  The resulting logarithmic values are then scaled to the range of visible image values.

Retinex is best suited for rescuing underexposed or badly color balanced images, or for extracting detail for scientific or technical purposes.  It is not always useful for enhancement of well-exposed naturalistic images.  For this, histogram equalization, adaptive contrast, or high-radius unsharp masking may be superior.  Related techniques include the shadows/highlights and exposure/gamma controls.  (And don’t forget auto levels and curves.)

The filter is based on the Very High Radius Unsharp Mask filter, and uses the same Gaussian blur technique which is suitable for very large images.

• The Radius setting (sometimes called “Scale”) is a percent of the image diagonal, so it is independent of the actual image size.  The apparent and preview-scaled radii in pixels are also displayed.  Lower values produce visible halos, which fade at higher values.  There is a tradeoff between dynamic range compression at small radii, and improved tonal rendition at large radii.  Three radii are actually used (multiscale retinex; the number is sometimes called “Scale division”); the image is processed three times at three different radii (2 pixels, the indicated radius, and 2× the latter), and the three images averaged together.  This tends to result in increased sharpness, “clarity,” and uniformity, but may also increase noise.  Multi is the weight of the multiscale effect; setting this to zero results in single-scale retinex.
• Contrast (sometimes called “Dynamic”; equivalent to “gain” in the literature) stretches the output histogram.  It determines how many standard deviations of pixels are included in the range of image values (the default is 1.5 s.d. on each side of the mean), and is thus adapted to each image.  Brightness (equivalent to “offset” in the literature) shifts the histogram to the left or right.  (I have no idea where the idea of “canonical” values for these came from; every image is different and needs its own adjustment.)

• Amount lets you blend the processed image (100%) with the original image (0%).
• Color controls how much of the processed vs. the original color components are included in the final image.  In Color Only mode (the Normal/Color Only button), only the color components are used in the final image; this may be useful if the only effect desired is color balance.  Vibrance preferentially increases the saturation of less-saturated areas of the image.  CR refers to color restoration.  It often has surprisingly little effect; it is included based on the literature.

• To map the logarithmic values back to a linear scale, use Linear mode (the Log/Linear button).  The filter is then homomorphic, not retinex.  Linear values sometimes have better tonal rendition, but not as good color correction.  Color restoration does not work with linear values and is not applied.

• Use the masks to protect blown shadows and highlights.  Masks may not be useful if there is a large color difference between the original and processed image.  Amounts greater than 100 only affect blurred areas of the mask.
• The white histogram (background) is the original image; the black one (foreground) is the processed image.

The plugin works with 8- or 16-bit RGB and grayscale images.


img img img img
Glenn Woodell’s dog Sally from the NASA site. Single scale retinex. Multiscale retinex; a little more sharpness and uniformity. Partial original colors with some extra vibrance, and a mask for the white fur.

img img
South Solon from the air by Nyttend. Processed separately for the earth and sky.
img img
img img
img img

References

Vivek Agarwal.  Achieving Color Constancy and Illumination Compensation[PDF]

Daniel J. Jobson, Zia-ur Rahman, and Glenn A. Woodell.  A Multiscale Retinex for Bridging the Gap Between Color Images and the Human Observation of Scenes[PDF]

Ana Belén Petro, Catalina Sbert, Jean-Michel Morel.  Multiscale Retinex[PDF]

Zia-ur Rahman, Daniel J. Jobson, Glenn A. Woodell.  Retinex Processing for Automatic Image Enhancement[PDF]

Zia-ur Rahman, Glenn A. Woodell and Daniel J. Jobson.  A Comparison of the Multiscale Retinex With Other Image Enhancement Techniques[PDF]


Simpler tutorials

Retinex Image Enhancement Techniques by Zhixi Bian and Yan Zhang.  [PPT]

Fast RETINEX for Color Image Enhancement:  Methods and Algorithms by Analysa M. Gonzales and Artyom M. Grigoryan.  [PDF]

Land’s Retinex algorithm by Edward Adelson.  [PDF]


More information

Retinex Image Processing at nasa.gov

The Gimp plugin

The ImageJ plugin

RawTherapee will soon include retinex.


Download

Download the zipped file, then copy Retinex.8bf into your plugins folder.  It will appear under “RC Filters.”

Retinex_x64.zip version 1.113, 294 KB, 64-bit applications.  It works for me in Photoshop CS5 and PhotoLine 19.5, Windows 7.

Retinex.zip version 1.113, 290 KB, 32-bit applications, Windows 32 or 64 bit.  It works for me in IrfanView 4, Windows 7. |  source code

Retinex_XP.zip version 1.113.1, 182 KB, “retro” 32-bit version compatible with Windows XP.


A payment of $5.00 is requested; the cost of web hosting is going up and I would like to keep offering compiled downloads; thank you.

Or click through an Amazon link and go shopping.


© 2015 by Russell Cottrell; released under the GNU General Public License.
Updated 12/5/2015.
5247