0
votes

I'm trying to transform my original gray image to mapped gray image using grey-scale mapping function. I have no idea how to get any two minima correspond to the grey-scale range [a,b] of the original histogram so that I can use these values for the equations below to get the mapped gray image.

f(x,y)=0 if [0,a),
f(x,y)=(255/(a-b))-a for [a,b],
f(x,y)=255 if (b,255]

Thank you!

1
I assume you are asking for the two extrema a and b. In that case, MATLAB has functions to find the maximum and minimum values. Also, your "code" is essentially pseudocode from a question it seems. is this homework? if so, it should be tagged as such.AruniRC
@AruniRC The homework tag is deprecatedDan
@Dan sorry my bad. getting old!AruniRC

1 Answers

1
votes

So essentially you want to scale the histogram of your image to range from 0 - 255. All you need is the max and the min. The easiest way to find them is

a = min(I(:));
b = max(I(:));

Also I suspect you middle equation should actually be

f(x,y)=(255/(a-b))*(f(x,y)-a) for [a,b]

however that would eliminate the need for your first two equations. So it's possible that a and b are not the extrema in your case but that you are actually trying to accentuate some range of intensities that sit in the middle of your images histogram (and essentially discard all information outside of that range). In this case you have not given us enough information to suggest values for either a or b.