Image converting from double to 0-255 sclae

조회 수: 11 (최근 30일)
KYU DEOK OH
KYU DEOK OH 2015년 2월 7일
답변: Stalin Samuel 2015년 2월 7일
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')

답변 (1개)

Stalin Samuel
Stalin Samuel 2015년 2월 7일

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by