0

I need to write a MATLAB script which takes a photo, mark 4 points (which make a 4-pointed shape, for example with ginput), and puts another image into that frame. This process might require all standard transformations: (shear, translate, scale or rotate), as the frame is not necessarily a rectangle (most probably a rectangle being shot from some angle).

I need help in finding and implementing the geometric transformation for the image to the frame.

Any suggestions? Thanks ahead

edit: to be more specific, I'm not sure how to calculate the transformation matrix after finding the relevant 4 points (x,y) coordinate matrix, which I find by using a function I created

function [framePoints] = manualMarkPoints(Image)
figure(2)
imshow(Image, [])
title('pick 4 points for the frame, then press ENTER')

[x, y] = ginput;
framePoints = [x y];
Oded Sayar
  • 427
  • 1
  • 4
  • 17
  • matlab documentation? – bla Jun 22 '15 at 23:20
  • Please narrow your question down to the points where you don't have an idea. Already mentioning `ginput` it seems you have at least some idea how to get the input. – Daniel Jun 22 '15 at 23:35
  • I added what I did so far, I don't know how to continue from here – Oded Sayar Jun 23 '15 at 00:12
  • 1
    Don't let the title of the post fool you. What you are describing is the homography recovery problem. The OP in that post only wanted to find rotation and translation, but I provided an answer that solves for any general homography (rotation, translation, scaling, shear). Simply put, you take your corresponding `(x,y)` points and solve for the geometric transformation (a.k.a. homography) that best describes the source points (the points from `ginput`) and the target points (the corner points for the target image). – rayryeng Jun 23 '15 at 03:41
  • 1
    Thanks, solved my problem – Oded Sayar Jun 23 '15 at 10:37

0 Answers0