• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RescaleOp Class

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 175
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The equation you have derived itself is wrong..
It should be..
newPixelValue = originalPixelValue * scaleFactor + offset
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic