Contrast stretching Equation problem
I think this is the equation you are using



http://en.wikipedia.org/wiki/Normalization_%28image_processing%29

where b=newMin and a=newMax These values can also be found from your histogram. Usually you expand the new image to take up the full intensity range. The intensity range of your image is the X-axis of your histogram. If it goes from 0 to 1, then a=1, b=0 if your hsitogram is from 0 to 255 a=255,b=0

a=newMax= most likely the last value of the x-axis on your histogram
b=newMin= most likely the very first value of the x-axis on your histogram
c=Min=last  nonzero element in histogram
d=Max=first nonzero element in histogram