Saving filtered image

조회 수: 4 (최근 30일)
Philip
Philip 2011년 3월 14일
I have tested some code that applies homomorphic filtering to an image in the logarithmic space:
%%%%%log of image
im_l=log(1+im);
%%%%%DFT of logged image
im_f=fft2(im_l);
%%%%%Filter Applying DFT image
im_nf=H.*im_f;
%%%%Inverse DFT of filtered image
im_n=abs(ifft2(im_nf));
%%%%%Inverse log
im_e=exp(im_n);
When this process is complete, the image can be displayed using imshow(im_e,[]), but since im_e is of type double I cannot save it as per what is seen from the imshow statement...
Does anyone know how to solve this problem so that the image can be saved properly?
Many thanks!

채택된 답변

Philip
Philip 2011년 3월 15일
% convert image to intensities
int_vals = mat2gray(im_e);
% save intensities using imwrite
imwrite(int_vals, 'filtered_image.png');

추가 답변 (1개)

Sean de Wolski
Sean de Wolski 2011년 3월 14일
  댓글 수: 3
Sean de Wolski
Sean de Wolski 2011년 3월 14일
If you look at the formats in doc imwrite you'll see what the requirements are for each format. Since your images are of class double you'll either need a format that supports double or to convert you images to one of the accepted formats.
Philip
Philip 2011년 3월 15일
Thanks, I played about for a while after your last comment and found that the easiest solution was to convert the data values to intensities using "mat2gray", and then saving the image as a PNG using "imwrite". This function converts the intensities to pixel values automatically before saving.
Thanks again!

댓글을 달려면 로그인하십시오.

카테고리

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