# reducing resolution of an image

9 visualizzazioni (ultimi 30 giorni)
kash il 9 Mag 2012
I have an image having resolution of 256x256,i want to reduce the resolution of image to 128x128,64x64,without using imresize conmmand please help
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposte (4)

Geoff il 9 Mag 2012
If you half the width and height, that means each group of 2x2 pixels becomes one pixel. You average the pixel intensities for each block and set that as your new pixel.
Well, you don't have to average them. You could select one or do any number of statistics on the chunk. But you should start simple.
The rest is just loops and matrix indexing. I'm sure you can cope with that.
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

Jessica Lam il 9 Mag 2012
you may try the following code. for resolution of 470 X 274
set(gcf,'PaperUnits','inches','PaperPosition',[0 0 4.7 2.74])
print('-dpng', 'filename.png', '-r100')
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Walter Roberson il 9 Mag 2012
That would seem to be increasing the resolution, rather than decreasing the resolution.

Accedi per commentare.

Jessica Lam il 9 Mag 2012
just change the vector of PaperPosition from [ 0 0 4.7 2.74 ] to something you want
for example [0 0 1.28 1.28] for 128x128 or [0 0 0.64 0.64] for 64X64
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Walter Roberson il 9 Mag 2012
Seems like an expensive way of reducing the resolution...

Accedi per commentare.

Walter Roberson il 9 Mag 2012
t = fft2(YourImage);
t(:,end/2+1:end) = [];
t(end/2+1:end,:) = [];
SmallerImage = ifft2(t);
or
t = reshape(YourImage, 2, size(YourImage,1)/2, 2, size(YourImage,2)/2, 2);
SmallerImage = cast(permute(mean(permute(mean(t,3),[1 2 4 3]),1),[1 2 3],[2 3 1]),class(YourImage));
##### 3 CommentiMostra 1 commento meno recenteNascondi 1 commento meno recente
Walter Roberson il 9 Mag 2012
For the first one, you might need to use
SmallerImage = cast(ifft2(t), class(YourImage));
For the second one it looks like I had an additional 2:
t = reshape(YourImage, 2, size(YourImage,1)/2, 2, size(YourImage,2)/2);
kash il 9 Mag 2012
walter getting same white figure window ,image is same not displaying ,warning as
Warning: Displaying real part of complex input.
for the next one i get error as
Error using ==> permute
Too many input arguments.

Accedi per commentare.

### Categorie

Scopri di più su Image Arithmetic in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by