1
votes

I am trying to transform an image using Bi-linear interpolation, my input image is I, I have my affine matrix [A], which will give me transformed image I', according to bi-linear interpolation I am taking inverse of affine matrix inv([A]) and applying that to every point of output image(which is all zero at initial level), as we cant guarantee that output image size can be of any size, so first I found the bounds so I can get the size of the output image,

Now I have input image, Affine matrix, and output image which have atleast that size in which transformed image can be saved easily, But If I apply backward backward method of warping, according to that I have to iterate through every pixel of output image(which is zero right now), I want my transformed image at the center so my transformed image should always be visible, any idea how can I do that ?

Note I don't want to use matlab's built in function.

EDIT enter image description here

If I transformed my A Image I got B, but You see corner of the image got cropped, I want those to be shown as well.

1
It is not exactly clear what you want from the description, but perhaps you could show how far you have come where exactly you get stuck? - Dennis Jaheruddin
I want my transformed image to be completely visible. If I create my new image of same size as input image, then my transformed image seems like it is cropped. - Muaz Usmani
Can you add a screenshot, or better yet some short code that will enable the problem to be reproduced? You may want to start with im=image to load an example image. - Dennis Jaheruddin

1 Answers

2
votes

When rotating a rectangle from the upright position to a diagonal one, the vertical distance between the highest and lowest point will increase.

Now there are two approaches you can take:

  • Put the new picture in a bigger environment

OR

  • Rescale the rotated picture to make it fit in the original sized environment.