Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

RescaleOp Class  RSS feed

 
Lin Shen
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
VIJAY Yadlapati
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The equation you have derived itself is wrong..
It should be..
newPixelValue = originalPixelValue * scaleFactor + offset
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!