Resizing image in pixels

5 ビュー (過去 30 日間)
WEIHUI
WEIHUI 2015 年 2 月 26 日
コメント済み: Guillaume 2015 年 2 月 26 日
Is there anyway to resize an image in terms of pixels? say, i want to resize my picture with no change of proportion to 160x160 pixels?
help is very much appreciated!

回答 (1 件)

Guillaume
Guillaume 2015 年 2 月 26 日
編集済み: Guillaume 2015 年 2 月 26 日
What about imresize, part of the image processing toolbox?
resizedimage = imresize(originalimage, [160 160]);
  2 件のコメント
WEIHUI
WEIHUI 2015 年 2 月 26 日
Thankyou! But i have tried this method and the image is 162pixelx160pixel somehow.
Guillaume
Guillaume 2015 年 2 月 26 日
Then post the code you're using, as it works fine for me:
originalimage = randi([0 255], 1000, 1000);
resizedimage = imresize(originalimage, [160 160]);
whos resizedimage
returns:
Name Size Bytes Class Attributes
resizedimage 160x160 204800 double

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

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by