How to make the output size of imwarp the same as the input?

28 ビュー (過去 30 日間)
渲航
渲航 2023 年 5 月 20 日
回答済み: 渲航 2023 年 5 月 21 日
I have some 3D images and wish to perform some rigid transform on them and keep the input size and output size the same. I used the imwarp function for these operations. But I found that it seems impossible to directly give parameters to ensure that the input and output have the same size as functions such as imrotate. How should I deal with it?
(Theoretically I can also crop or pad by myself, but sometimes the size of the image has an odd number, which makes it difficult to define the transformation by myself.)

採用された回答

Matt J
Matt J 2023 年 5 月 20 日
There is an OutputView input parameter that will let you control that,

その他の回答 (1 件)

渲航
渲航 2023 年 5 月 21 日
I found the solution by Matt J's answer
Besides the transform defnition
tform = rigidtform3d(rotation,translation);
We should define another object by function affineOutputView, such as
sameAsInput = affineOutputView(size(img_pad),tform,"BoundsStyle","SameAsInput"); % the same output size as input
then applied both of them
res_volume = imwarp(img,tform,"OutputView",sameAsInput);

カテゴリ

Help Center および File Exchange3-D Volumetric Image Processing についてさらに検索

製品


リリース

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by