Are all grayscale images of the size 256*256. Please clarify

8 ビュー (過去 30 日間)
N/A
N/A 2015 年 11 月 27 日
コメント済み: N/A 2015 年 11 月 27 日
I am using a .png image for processing. I converted it to grayscale and the value shown for the image is 289x318 uint8.. When I used [r c d]= size(I), I got r= 289, c=318 and d=1. Does it mean that my image has been grayscaled or not? And what does size 256*256 mean? Does it signify the values inside the matrix?

採用された回答

Thorsten
Thorsten 2015 年 11 月 27 日
編集済み: Thorsten 2015 年 11 月 27 日
The size of your image is 289 x 318, as returned by the size command. Why do you think that the size is 256*256? A grayscale image can be of any size, only some of them are of size 256 x 256. The range of values are from 0 to 255, for a uint8 type image, so each pixel can take one from 256 different values. But that's the value of a pixel and has nothing to do with the size.
  3 件のコメント
Thorsten
Thorsten 2015 年 11 月 27 日
編集済み: Thorsten 2015 年 11 月 27 日
You can crop the image
I = I(1:256, 1:256);
You can also resize the image using imresize, if it is square, or use a combination of resizing and cropping:
[r, c] = size(I);
I = imresize(I, 256/min(r,c));
I = I(1:256, 1:256);
N/A
N/A 2015 年 11 月 27 日
Il try that out. Thank you very much.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeConvert Image Type についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by