Take the 2-minute tour ×
Signal Processing Stack Exchange is a question and answer site for practitioners of the art and science of signal, image and video processing. It's 100% free, no registration required.

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?

share|improve this question
add comment

2 Answers 2

up vote 1 down vote accepted

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.

share|improve this answer
    
can't be clearer than this. thanks a lot –  Androidy Jan 30 '13 at 13:14
    
let's say i want to double the image contrast. what will i need to do then. just add a bigger b? –  Androidy Jan 30 '13 at 13:26
    
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]. –  bjoernz Jan 30 '13 at 13:56
    
@ok i will do that thanks. –  Androidy Jan 30 '13 at 13:59
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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