Cut a picture as needed

1 回表示 (過去 30 日間)
tao wang
tao wang 2022 年 3 月 26 日
コメント済み: tao wang 2022 年 3 月 26 日
For example, I want to cut the picture into 9 pictures. I want to use the for loop, and then save the cut image into variables A1, A2,,, an. In this way, how do I in AI in the for loop change with the loop? I know how to save it locally, but I want to save it into the workspace. Thank you. I'd appreciate it if you can give an example

採用された回答

Matt J
Matt J 2022 年 3 月 26 日
編集済み: Matt J 2022 年 3 月 26 日
Download mat2tiles and then,
Image=rand(900);
A=mat2tiles(Image,[300,300])
A = 3×3 cell array
{300×300 double} {300×300 double} {300×300 double} {300×300 double} {300×300 double} {300×300 double} {300×300 double} {300×300 double} {300×300 double}
  4 件のコメント
Matt J
Matt J 2022 年 3 月 26 日
編集済み: Matt J 2022 年 3 月 26 日
Each element in the array is in decimal form, but shouldn't the image be an integer?
If you gave mat2tiles an integer array, the cells should be of that type as well.
Image=randi(255,900,'uint8');
mat2tiles(Image,[300,300])
ans = 3×3 cell array
{300×300 uint8} {300×300 uint8} {300×300 uint8} {300×300 uint8} {300×300 uint8} {300×300 uint8} {300×300 uint8} {300×300 uint8} {300×300 uint8}
tao wang
tao wang 2022 年 3 月 26 日
Sorry, it's actually a double precision form with a decimal point. That's wrong
This is the method I wanted to use before. Thank you

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

その他の回答 (0 件)

カテゴリ

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