Creating a foggy image

Here is my attempt to imagine Lena in a fog

img = ExampleData[{"TestImage", "Lena"}];
r = 200;
r0 = 2;
ker = Table[1/(i^2 + j^2 + r0^2), {i, 0. - r, r}, {j, 0. - r, r}];
ker = ker/Total[ker, 2];
foggy = ImageConvolve[img, ker]

enter image description here

I think Lorentzian kernel is quite good for the fog: it has a sharp peak and broad tails

Plot3D[1/(i^2 + j^2 + r0^2), {i, -10 r0, 10 r0}, {j, -10 r0, 10 r0}, 
 PlotRange -> {0, All}, PlotPoints -> 100]

enter image description here

With the ambient lighting (thanks to Simon Woods!):

ImageApply[0.7 # + 0.3 &, foggy]

enter image description here


Does this work for you? (otherwise I'll delete it and let the imaging experts handle this)

img = ExampleData[{"TestImage", "Lena"}];

Then:

res = ImageConvolve[img, BoxMatrix[8]/289.];

ImageAssemble[{img, res}]

Mathematica graphics


This uses Radon/InverseRadon transforms adding to Mathematica in version 8.

The core of the logic is in this line:

ImageAdjust@InverseRadon[Radon[img, {n, n}, Method -> method],
   "Filter" -> inverseMethod, "CutoffFrequency" -> cutOffFrequency]

By controlling the cutoff frequency, methods used, and applying your own custom backprojection method, you can achieve many different foggy effects.

enter image description here

code:

Manipulate[
 ImageAdjust@InverseRadon[Radon[img, {n, n}, Method -> method],
    "Filter" -> inverseMethod, "CutoffFrequency" -> cutOffFrequency]
 ,
 Grid[{
   {Control[{{cutOffFrequency, 1, Text@Row[{Subscript[Style["f", Italic, 11], 
      Style["c", Italic, 11]]}]}, .01, 1, 0.01,
      ImageSize -> Small, Appearance -> "Labeled"}]
   },
   {Control[{{method, "Radon", "Radon method"}, {"Radon", "Hough"}, 
       ControlType -> PopupMenu, ImageSize -> All}]},
   {
    Control[{
      {inverseMethod, # Cos[# Pi] &, "Inverse Radon method"},
      {(1 + Cos[# Pi])/2 & -> "Hann",
       1 & -> "Rectangular",
       # & -> "Ramp-Lak",
       # Sin[# 2 Pi] & -> "Sin Ramp",
       # Cos[# Pi] & -> "Cosine Ramp",
       ((1 - 0.16)/2 - (1/2) Cos[# Pi] + 0.08 Cos[# 2 Pi]) & -> "Blackman",
       (0.355768 - 0.487396 Cos[# Pi] + 0.144232 Cos[# 2 Pi]) - 
         0.012604 Cos[# 3 Pi] & -> "Nuttal window",
       Sinc[#] & -> "Shepp-Logan",
       (.54 + .46 Cos[# Pi]) & -> "Hamming",
       Sqrt[1/(1 + #^(2))] & -> "Butterworth order 1",
       Sqrt[1/(1 + #^(4))] & -> "Butterworth order 2",
       Sqrt[1/(1 + #^(6))] & -> "Butterworth order 3",
       None -> "No filter"},
      ControlType -> PopupMenu, ImageSize -> All}]
    }}],
 ContinuousAction -> False,
 Initialization :>
  (
   n = 200;(*image size to display, smaller is faster*)
   img = ExampleData[{"TestImage", "Lena"}];
   )
 ]