One way to derive this formula is as follows. A linear function of has the form for some constants . Therefore, we form a system of equations
and solve it to find and in terms of and .
I am trying to write a program that compares two images. That info is not too important.
What is important is, that once I ratio the images, I get values starting from decimal numbers (like .0001) to possibly very large numbers (like 10..20..30.....100) depending on what two images I am ratioing.
The problem is that I am working in GIMP, and image values go from 0 to 255. So anything tiny is getting set to 0.
Is there some sort of algorithm that will scale my ratio results to these 0-255 values? So lets say I have values between .0001 (lets say, make this value arbitrarily 'a') to 20 ('b'). How can I scale the .0001 to correspond to zero ('x'), the 20 to correspond to 255('y'), and anything in between to scale accordingly? So transform a->x, b->y for arbitrary values of a and b.