posted 20 years ago
the constructor of RescaleOp is: RescaleOp(float scaleFactor float offset, null) It performs function, pixel = pixel * scaleFactor + offset, for every pixel of a image. I have two sliders to change the values of scaleFactor and offset on the GUI and the program does change the effects of the image. But I cannot change the image back to the original one. The reason is shown below:
Assume pixel = 5, scaleFactor = 2, offset = 0 as origin.
if I adjust a slider to change the value of offset to be 1.
pixel = 11 now according to the function pixel = pixel * scaleFactor + offset.
Now I want to change back to the initial image. So I adjust the slider again and set offset to be 0 again: pixel = 11 * 5 + 0 = 55, which is not the same as the initail value 5.
What sort of change can I make to my program? Is there any fuction I can perform when changing the value of scalefactor and offset?