Add an expression to the result

1 回表示 (過去 30 日間)
Abduellah Elbakoush
Abduellah Elbakoush 2022 年 2 月 4 日
回答済み: Rik 2022 年 2 月 4 日
I have Image , after i read the image i did this code
[row column]=size(image)
Now I want to display at command window Like that
The Height of image is = row
The width of image is = column
Can you Help me

回答 (2 件)

Davide Masiello
Davide Masiello 2022 年 2 月 4 日
fprintf('The height of the image is %d\n', row)
fprintf('The width of the image is %d\n', column)

Rik
Rik 2022 年 2 月 4 日
Appart from the other answer providing you with a solution to your question (i.e. to use fprintf), there is another issue:
im=imread('peppers.png');%read an example image
sz=size(im),[row,column]=size(im)
sz = 1×3
384 512 3
row = 384
column = 1536
See the value of column?
This behavior is documented. Read the documentation for the size function to learn how to get around this.

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by