17
$\begingroup$

Disclaimer: I am in NO way engaged in signal processing. Just very curious...

Ny question is, very simply: is it possible to apply software processing to an image to remove or reduce headlight glare?

It would be a picture such as this:
http://www.driversedguru.com/wp-content/gallery/jamie-gallery/Lots%20of%20Glare.jpg

If this IS possible, is there a software library available for this? I don't care which language, I just want the capabilities. Slash does anyone know if there is current research on this?

$\endgroup$
6
  • 3
    $\begingroup$ Is that "glare" or "lens flare"? $\endgroup$
    – endolith
    Oct 13, 2011 at 18:51
  • $\begingroup$ Good point. I should clarify: I'm interested in normalizing the light level across the image (though specifically the cars). So, reduce the spot brightness/washout of headlights and increase the visibility of the cars themselves. So...glare or lens flare, either way (I guess). $\endgroup$
    – BenCole
    Oct 13, 2011 at 18:55
  • $\begingroup$ Well there are ways to actually remove things like that, with deconvolution, I think, instead of just reducing their brightness, but I'm not sure $\endgroup$
    – endolith
    Oct 13, 2011 at 20:16
  • $\begingroup$ I'm imagining something like this: ftp.cfar.umd.edu/pub/aagrawal/Glare/AgrawalGlareLowRes.pdf except a bit more advanced in that it (1) reduces the glare using similar methods described in that paper; then (2) removes the actual light source from the picture; and (3) [fuzzy about this step] reduces glare again and enhances area around the light source. $\endgroup$
    – BenCole
    Oct 13, 2011 at 20:29
  • $\begingroup$ Well that example requires modifying the optics of the camera before taking pictures, it seems $\endgroup$
    – endolith
    Oct 13, 2011 at 20:56

1 Answer 1

6
$\begingroup$

The problem you might have is that when bright lights are present, the camera will be using a fast shutter speed to keep the image from saturating too much. All the detail you are interested in is in the bottom few bits of the data.

So even if you remove the glare and then try and pull the rest of the image up in level, it's very noisy. For example, if you take your image and play with the levels to pull up the darker sections and just allow the glare to clip, this is the result:

"Brighter" version

If that's OK for onward processing (I don't know what you have in mind) then you could maybe remove the glare by looking at distributions of saturated pixels, and expand into the "glow" around them.

A better solution (if you have the option) can be to use a high-dynamic range camera which has an non-linear response in the pixels, and also often 10 or 12 bits per pixel of usable resolution, which means you can keep 7-8 bits for the darker sections.

$\endgroup$
5
  • $\begingroup$ Fair enough. You've given me a good direction to go off in though, so thanks! $\endgroup$
    – BenCole
    Oct 14, 2011 at 13:21
  • $\begingroup$ You don't need a high dynamic range camera. You just need to take multiple pictures at different exposure levels. Canon cameras can be configured to do this automatically with CHDK firmware. chdk.wikia.com/wiki/Samples:_HDR $\endgroup$
    – endolith
    Oct 29, 2011 at 21:30
  • 2
    $\begingroup$ @endolith - Yes, you don't need an HDR camera... if your scene is changing slowly enough you can do it in software. But for the picture above I'd doubt it - I do automotive vision systems and 30Hz is barely enough, I'd hate to have to wait for several frames to get data! $\endgroup$ Oct 29, 2011 at 22:20
  • 1
    $\begingroup$ Could you do rolling CHDK image updates? Rather than waiting for several discrete frames, have ranges like: {frame1,2,3,4}, {frame2,3,4,5}, {frame3,4,5,6}, etc? Or would this be too slow? $\endgroup$
    – BenCole
    Nov 8, 2011 at 22:14
  • $\begingroup$ @BenCole: yes, that's workable some of the time, but even one extra frame of latency would be too much in some applications. In fact, the scene change from one frame to the next would mean that "HDR by stacking several exposures" wouldn't work out too well $\endgroup$ Nov 9, 2011 at 10:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.