0

currently i am working on my demosiac converter project which convert RAW images , one step of converting image is the gamma correction .

this is my gamma correction function in matlab :

function [res] = gamma_correct(I, value)

% res = gamma_correct(I, value)
%
% This function performs gamma correction
% on image 'I' where 'value' is the gamma

res = I;


X = 255 * (I/255).^(1/value);
imshow(X);

end

this function runs without errors but finally it gives me a wrong output

this is a screenshot of the output i get

any help ?

Halawa
  • 1,171
  • 2
  • 9
  • 19
  • I can't quite tell what I'm looking at. ;) The image is pretty small. What's wrong with it? Is is over-saturated? – eigenchris Mar 06 '15 at 01:29
  • and this is the problem as i expect something like this [link](http://postimg.org/image/7ttoj985l/) – Halawa Mar 06 '15 at 01:34
  • 2
    I can't say I know why the image changed size. Try using `I = double(I);` before you do any calculations on the image though. Doing division with integers will floor the result, to zero if the image is `uint8` type. – eigenchris Mar 06 '15 at 02:01
  • Are you sure you are passing the correct image into your function? What where are you pulling the data to get the good and bad outputs you show? – TallBrianL Mar 06 '15 at 03:50
  • actually this is the image i want to apply the function on [link](http://postimg.org/image/7ttoj985l/) and this the output i get after applying the function [link](http://postimg.org/image/rn6s8rvkv/) – Halawa Mar 06 '15 at 04:08

0 Answers0