Image converting from double to 0-255 sclae

4 visualizaciones (últimos 30 días)
KYU DEOK OH
KYU DEOK OH el 7 de Feb. de 2015
Respondida: Stalin Samuel el 7 de Feb. de 2015
Hello,
I want to convert image after filtering
After filtering, the filtered image consist of positive and negative number(X.xxxx)
I want change this type of number to 0-255 integer for calculation of average and standard deviation of image.
I want to know if there is any solution to this problem. kindly help.
I already tri to convert image using mat2gray and im2uint8.
failed result....
matlab script
A=imread('solid print_1.tif');
[M N]=size(A);
A=double(A);
F1=fft2(A);
u=0:(M-1);
v=0:(N-1);
idx=find(u>M/2);
u(idx)=u(idx)-M;
idy=find(v>N/2);
v(idy)=v(idy)-N;
[U,V]=meshgrid(u,v);
D=sqrt(U.^2+V.^2);
D0=76.2;
W=50.8;
H1=double(D<(D0-W/2));
H2=double(D>(D0+W/2));
H=double(H1|H2);
H=1-H;
G=H.*F1;
G=ifft2(G);
G=real(G);
ff=abs(fftshift(H));
subplot(131),imshow(A,[0 255]),title('1')
subplot(132),imshow(ff),title('2')
subplot(133),imshow(G,[]),title('3')

Respuestas (1)

Stalin Samuel
Stalin Samuel el 7 de Feb. de 2015

Community Treasure Hunt

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

Start Hunting!

Translated by