Imresize3 not resizing in z direction?

6 ビュー (過去 30 日間)
Wasgeht Siedasan
Wasgeht Siedasan 2021 年 12 月 15 日
コメント済み: Wasgeht Siedasan 2021 年 12 月 15 日
Hello,
I was using imresize on a stack of 54 images (each 2350 by 2350) forming a 3d array.
the pictures are binary. I also tried with grayscale.
I tried it like this:
stackresized = imresize3(stack, [NaN NaN 9 ]);
which crashed matlab.
I tried
stackresized = imresize3(stack, 0.2)
Which worked, but only in x and y directions. the number of slices remained the same.
Edit: I was mistaken, it used simply just one slice at a time from the array in the second example. When i feed it the whole array, the error is "Input image must have three dimensions but instead has 4 dimensions."
Which is strange because it is a grayscale 0-255, one colour channel of a RGB stack. should be 3 dimensional.
Can someone explain what I'm doing wrong here?
Thanks.

採用された回答

Chris
Chris 2021 年 12 月 15 日
The second method should work. Are you sure you used imresize3() and not imresize() for that?
For the first method, input all three desired dimensions, even if they don't change from the original.
  3 件のコメント
Chris
Chris 2021 年 12 月 15 日
編集済み: Chris 2021 年 12 月 15 日
Try
squeeze(stack)
to remove the third (size 1) dimension. Or,
stack = squeeze(RGBstack(:,:,1,:));
Wasgeht Siedasan
Wasgeht Siedasan 2021 年 12 月 15 日
works, thanks

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

製品


リリース

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by