MATLAB Answers

0

How to Downsample image in both Horizontal and Vertical Direction

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

  0 Comments

Sign in to comment.

1 Answer

Answer by Sean de Wolski
on 7 Dec 2012
Edited by Sean de Wolski
on 7 Dec 2012
 Accepted Answer

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 Comment

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.

Sign in to comment.