Problem with affine rectification

I have been trying to perform affine rectification using Matlab. By using Hough Lines I find two sets of parallel lines, I compute both of the vanishing points and then I find the vanishing line:
p1=[1056 2862 1];
p2=[1374 2692 1];
l1=cross(p1,p2);
p1=[2316 253 1];
p2=[2639 27 1];
l2=cross(p1,p2);
p1=[1149 2334 1];
p2=[1111 2833 1];
m1=cross(p1,p2);
p1=[1519 1602 1];
p2=[1532 2014 1];
m2=cross(p1,p2);
v1=cross(l1,l2);
v1=v1/v1(3) // =1.0e+03 * [-9.4067 8.4553 0.0010]
v2=cross(m1,m2);
v2=v2/v2(3); // =1.0e+03 * [1.4269 -1.3157 0.0010]
v_line = cross(v1,v2);
//
H = [1 0 0; 0 1 0; v_line(1)/v_line(3) v_line(2)/v_line(3) 1];
H_p=projective2d(H);
I_aff=imwarp(I, H_p);
The problem is that I_aff is exactly as the input image. Nothing happened. What am I doing wrong?

回答(0 个)

类别

帮助中心File Exchange 中查找有关 Read, Write, and Modify Image 的更多信息

产品

版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by