1
$\begingroup$

this was a question i found online.

given an image with values between [0,1].
how can I get the maximum contrast using linear gray-level transformation?
something like I(x,y)=A*I(x,y)+B , where I is a histogram.
we are also given MAX(I) and MIN(I).

as far as i can understand. MAX(I) and MIN(I) will give you the values you have now and you wan to stretch the values into 0 and 1.

but how will this give me a linear equation?

$\endgroup$
2
$\begingroup$

You want to design a linear transformation, that puts the MIN(I) at 0 and the MAX(I) at 1. A linear equation has the form: y = m*x+b, where m is the slope and b is the point on the y-axis for x = 0.

You want to choose m such that it goes from 0 to 1 (dy = y_max - y_min = 1 - 0 = 1) within the interval from MIN(I) to MAX(I) (dx = x_max - x_min = MAX(I) - MIN(I)):

m = 1/(MAX(I)-MIN(I));

Next you want to make sure, that y = m * MIN(I) + b == 0:

b = -m*MIN(I);

If you have any further questions, let me know.

$\endgroup$
  • $\begingroup$ let's say i want to double the image contrast. what will i need to do then. just add a bigger b? $\endgroup$ – Gilad Jan 30 '13 at 13:26
  • $\begingroup$ I suggest, that you open a photograph (convert into grayscale if needed) in GIMP (www.gimp.org) and play around with the "Colors -> Curves" menu item. This way you can see the effects immediately. In order to increase the contrast, you have to increase the slope (m) and adjust b accordingly. Now some values will need to be clipped to the allowed interval [0;1]. $\endgroup$ – bjoernz Jan 30 '13 at 13:56
3
$\begingroup$

If you're subtracting the minimum and stretching the maximum remaining value to be 1, you get the following:

Let $m = \min\{I(x,y)\}$ and $M = \max\{I(x,y)\}$ $$I_{\text{new}}(x,y) = \frac{I(x,y) - m}{M-m} = AI(x,y)+B $$

where $A=\dfrac{1}{M-m}$ and $B = -\dfrac{m}{M-m}$

Hope this clears it up.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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