how can i use log function on the image pixels without converting image pixels into normalized8 form?

5 vues (au cours des 30 derniers jours)
my main focus is to scale the pixels by multiplying pixels with some constant to make image clearer. but first of all i want to use log function on the image to enhance the image but for that i need to convert that pixels into normalized8. can i use log function without converting it into normalized8 form.
X=imread('2.pgm'); figure,imshow((X)); %X=normalize8(X); [a,b]=size(X); M=a; N=b;
for ia=1:M for ib=1:N Y(ia,ib)=X(ia,ib)*2;
end
end
figure,imshow(Y);
%% Transform to logarithm X=log(X+1);
here, if i am not converting it into normalization8 then it shows Y image that is scaled. but it gives error for log function. ??? Undefined function or method 'log' for input arguments of type 'uint8'.
Error in ==> DCT_norm at 21 X=log(X+1);
if i am converting it into normalized8 then i cant see the appropriate result for scaling. i get just white colored image.
is there any way of using log function without converting it into normalized8??? please help me out...

Réponse acceptée

Image Analyst
Image Analyst le 11 Mai 2014
I never heard of normalized8. Why don't you just use imadjust:
newmap = imadjust(map,[low_in; high_in],[low_out; high_out],gamma)
varying the gamma has the effect of varying how much curvature is applied to the transfer function - sort of a variable way of doing what you're trying to do with the log().
If you insist on doing it yourself and not use the built-in, tested and validated imadjust() function, just cast (the badly-named) X into double before going into the log function.

Plus de réponses (0)

Catégories

En savoir plus sur Modify Image Colors dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by