How to Downsample image in both Horizontal and Vertical Direction

20 vues (au cours des 30 derniers jours)
Chandra Shekhar
Chandra Shekhar le 7 Déc 2012
Any one help me how to downsample image in horizontal direction and vertical direction.
i used downsample(image,4), it will down sample image in both the direction, but i need to downsample separately for horizontal and vertical.
Does any know suggest me please.
Thank You

Réponse acceptée

Sean de Wolski
Sean de Wolski le 7 Déc 2012
Modifié(e) : Sean de Wolski le 7 Déc 2012
For grayscale:
Xdown = X(1:2:end,1:2:end);
If it's RGB, keep the third dimension:
Xdown = X(1:2:end,1:2:end,:);
  1 commentaire
Image Analyst
Image Analyst le 7 Déc 2012
That's how I'd do it for simple subsampling by an integer (2, 3, 4, etc.). There is also the imresize() function that you can use. It will handle interpolation if the subsampling is not by integer amounts.

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by