1

I'm looking for a method about the power calculation in Matlab. The code like s following

Corrected = 255 * (Image/255)^(1/2.2)

but as you can see this, this make an error like this:

Error using ==> mpower
error happened like this. Integer can only be raised to positive integra powers

So what can I do fix it?

Carter
  • 274
  • 2
  • 13

2 Answers2

0

Im not completely sure what you are asking but, try using the . operator so do .^ instead of ^

David
  • 127
  • 1
  • 11
0
Corrected = 255 .* exp((1/2.2) .* log(double(Image./255)))

Check power via logarithms and log not defined for type uint8

Community
  • 1
  • 1
Kirill Slatin
  • 6,085
  • 3
  • 18
  • 38