MATLAB: How to apply a natural logarithm to an image

image processingnatural logarithm

%%4 image natural log test
%%apply natural log function on the image 'image' to get 'ln_image'
%%note: you need to use mat2gray to convert the format of the image
%also, change negative values to postivie for display purpose
%add instruction here
ln_image = ;
subplot(2,3, 5);
%use display image with scaled colors command (not imshow). put title 'natural log'
%add instructions here
imagesc(ln_image);
title('Natural Log');

Best Answer

Did you try ln_image =log(mat2gray(image))?
By the way it's a terrible idea for them to tell you to use the word "image" for your variable name. image() is a built-in function. If there are any zeros in your image you should add 1 to the image before taking the log of it.
Related Question