Hello,
I want to apply a transformation to an image using this imwarp function. It seems to be able to read all the inputs B = imwarp(A, tform). The input image is 1140x800. However, the output image has different dimensions. I want the transformed output image to also have the same dimensions as the input image (1140x800). Is there any way to do so?

 채택된 답변

Matt J
Matt J 2021년 11월 18일
편집: Matt J 2021년 11월 18일

0 개 추천

댓글 수: 3

Hey,
Thanks for your answer! However, our tform is in the form of a projective2d. When I try to run the code you mentioned, I get this error:
Error using affineOutputView>parseInputs (line 144)
The value of 'tform' is invalid. Expected tform to be one of these types:
affine2d, affine3d
Instead its type was projective2d.
Error in affineOutputView (line 57)
inputs = parseInputs(tform,sizeA,varargin{:});
Is there a similar function for a projective2d input? Just as a note, we are deriving the tform file from a fitgeotrans function (unsure if this provides an insights).
Matt J
Matt J 2021년 11월 18일
편집: Matt J 2021년 11월 18일
I don't think there is a projective2dOutputView() utility, but you can always just use imref2d() to create your own OutputView specification.
Hey Matt,
Thanks for your response. How would I set up the code using imref2d() for the centerOutput, followOutput, and sameAsInput under the imwarp function?
Ideally, all I need is to apply the transformation within a set bound of 1140x800. However, like I said before, once the transformation is applied, the output goes beyond these bounds. All the transformation are applied properly except for the translation/placement of the slice.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

제품

릴리스

R2019b

질문:

2021년 11월 18일

댓글:

2021년 11월 29일

Community Treasure Hunt

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

Start Hunting!

Translated by