how can i use log function on the image pixels without converting image pixels into normalized8 form?
2 次查看(过去 30 天)
显示 更早的评论
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...
0 个评论
采纳的回答
Image Analyst
2014-5-11
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.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Modify Image Colors 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!