skip to Main Content

I want a formula to detect/calculate the change in visible luminosity in a part of the image,provided i can calculate the RGB, HSV, HSL and CMYK color spaces.

enter image description here

E.g: In the above picture we will notice that the left side of the image is more bright when compared to the right side , which is beneath a shade.

2

Answers


  1. I have had a little think about this, and done some experiments in Photoshop, though you could just as well use ImageMagick which is free. Here is what I came up with.

    Step 1 – Convert to Lab mode and discard the a and b channels since the Lightness channel holds most of the brightness information which, ultimately, is what we are looking for.

    Step 2 – Stretch the contrast of the remaining L channel (using Levels) to accentuate the variation.

    Step 3 – Perform a Gaussian blur on the image to remove local, high frequency variations in the image. I think I used 10-15 pixels radius.

    Step 4 – Turn on the Histogram window and take a single row marquee and watch the histogram change as different rows are selected.

    Step 5 – Look out for a strongly bimodal histogram (two distimct peaks) to identify the illumination variations.

    This is not a complete, general purpose solution, but may hold some pointers and cause people who know better to suggest improvememnts for you!!! Note that the method requires the image to have a some areas of high uniformity like the whiteish horizontal bar across your input image. However, nearly any algorithm is going to have a hard time telling the difference between a sheet of white paper with a shadow of uneven light across it and the same sheet of paper with a grey sheet of paper laid on top of it…

    In the images below, I have superimposed the histogram top right. In the first one, you can see the histogram is not narrow and bimodal because the dotted horizontal selection marquee is across the bar-code area of the image.

    enter image description here

    In the subsequent images, you can see a strong bimodal histogram because the dotted selection marquee is across a uniform area of image.
    enter image description here
    enter image description here

    Login or Signup to reply.
  2. The first problem is in “visible luminosity”. It me mean one of several things. This discussion should be a good start. (Yes, it has incomplete and contradictory answers, as well.)

    Formula to determine brightness of RGB color

    You should make sure you operate on the linear image which does not have any gamma correction applied to it. AFAIK Photoshop does not degamma and regamma images during filtering, which may produce erroneous results. It all depends on how accurate results you want. Photoshop wants things to look good, not be precise.

    In principle you should first pick a formula to convert your RGB values to some luminosity value which fits your use. Then you have a single-channel image which you’ll need to filter with a Gaussian filter, sliding average, or some other suitable filter. Unfortunately, this may require special tools as photoshop/gimp/etc. type programs tend to cut corners.

    But then there is one thing you would probably like to consider. If you have an even brightness gradient across an image, the eye is happy and does not perceive it. Rather large differences go unnoticed if the contrast in the image is constant across the image. Unfortunately, the definition of contrast is not very meaningful if you do not know at least something about the content of the image. (If you have scanned/photographed documents, then the contrast is clearly between ink and paper.) In your sample image the brightness changes quite abruptly, which makes the change visible.

    Just to show you how strange the human vision is in determining “brightness”, see the classical checker shadow illusion:

    http://en.wikipedia.org/wiki/Checker_shadow_illusion

    So, my impression is that talking about the conversion formulae is probably the second or third step in the process of finding suitable image processing methods. The first step would be to try to define the problem in more detail. What do you want to accomplish?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search