フィルターのクリア

Why the dimensions of my picture in pixels is reduced when I save my image?

3 ビュー (過去 30 日間)
Aude Rapet
Aude Rapet 2017 年 2 月 3 日
コメント済み: Aude Rapet 2017 年 2 月 5 日
Hi,
I filter an imageA with a function called bpass and then I display it with imagesc to be able to save it (as .tif). ImageA is 1038*1388 pixels, my filtered image is 1038*1388 double as well, but when I save it (right click on the image, save as...), the picture I then open is 560*420 pixels. Why...?
%Read the image
prepreim = imread('well8 aft.tif');
preim = rgb2gray(prepreim); % Convert uint8 color to uint8 gray scale.
im = double(preim); % Convert to double in the range 0-255.
%spatially filter the image
b = bpass(im,1,4);
figure
colormap gray
imagesc(b)
%save the filtered image
figure, colormap gray, imagesc(b);
set(gca,'xtick',[],'ytick',[]); %remove axis
set(gca,'LooseInset',get(gca,'TightInset')); %remove white band
Not to save it manually, I tried to add the line
saveas(gcf,'8beffilter','tiffn');
But in this case I obtain a picture of dimension 875*656 pixels.
Thank you for your help.

採用された回答

Image Analyst
Image Analyst 2017 年 2 月 3 日
That probably saves the whole figure, not the image. Use imwrite() instead to save the image array only.
  6 件のコメント
Image Analyst
Image Analyst 2017 年 2 月 3 日
You'll need to also give us code for bpass().
Aude Rapet
Aude Rapet 2017 年 2 月 5 日
Here is the link to download the code for bpass : http://site.physics.georgetown.edu/matlab/code.html

サインインしてコメントする。

その他の回答 (1 件)

John BG
John BG 2017 年 2 月 3 日
if the bpass function is removing samples to low band pass filter, then the resulting image is going to be smaller.
have you checked that images b and im are same size?
John BG
  2 件のコメント
Walter Roberson
Walter Roberson 2017 年 2 月 3 日
"my filtered image is 1038*1388 double as well"
Aude Rapet
Aude Rapet 2017 年 2 月 3 日
Yes I checked :
>> whos im
Name Size Bytes Class Attributes
im 1038x1388 11525952 double
>> whos b
Name Size Bytes Class Attributes
b 1038x1388 11525952 double

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by