MATLAB: How to transform points (pixel points) of the same different size images

digital image processinggraphicsimage analysisprogramming

I have attached an figure, here we see two images A and B, but they are different size. I have the points of a rectangle (e.g., for image B). How can I transform the points
from B to A?

Best Answer

Just multiply the row index of the points by the ratio of the row sizes, and the column index by the ratio of the column sizes.
[rowsa, columnsa, numColorsa] = size(imageA);
[rowsb, columnsb, numColorsa] = size(imageB);
% Transform point 1
row1b = round(row1a * rowsb / rowsa);
col1b = round(col1a * columnsb / columnsb);
Same for any other points, like the other 3 vertex points.