zyxrrr/cs231a

I think your ps1.p3.compute_rotation_matrix_between_cameras() is wrong

Closed this issue · 16 comments

hi, @zyxrrr
So appreciate your answer as a reference for me. And I think your ps1.p3.compute_rotation_matrix_between_cameras() return matrix R is wrong, because the euler z is -8 degree as the most change axis. Intuitively, I'v saw the camera around y axis is change most. So the y axis should be -8 degree. Go deep, I derived the formula using here, and I found that the R equals infinite point 2 dot the inverse of infinite point 1 in camera space rather than the inverse of infinite point 1 dot infinite point 2.
Any response is highly appreciate!

Yes,You are right.Thank you!

As My learning continuing, I have found your compute_epipole() may be incorrect, because you use first row of VT (belong to U,s,VT), and as all epipolar lines through epipole, so the last row of VT is what we want.
I found an another mistake but I have forgotten. Maybe that is a trivial one. lol

Yes,I have corrected it.But I can't get the result(rectified image) like section3.pdf.

I found that! sorry I am really busy over the past few days so stop to dig it. I go on to study this lesson now, I will give you an answer in few hours.

I am sure the M in F=[e']x M is wrong by the formula in slides, because the F is incorrect using F=[e']x M to check M.
But I haven't deduced the right formula yet.
H1 is incorrect I found.

The M = [e] × F + ev T in slides, I also don't know where is wrong.

I am done! After learning and referring to the book recommended in slides called "Multiple View Geometry in Computer Vision (Second Edition)".
Yes, the formula M = [e] × F + ev T is right. I will give you some clues rather than an answer now, because I think you have the ability to figure out yourself. We have to realize the symmetric of this process. The second image and the first image just are chosen by individual. And this group of formulas are constrained by basic conditions. Check the necessary conditions you will find what you want.

Hi @zyxrrr ,
What are you think about the The Factorization Method problem in homework? I am not very clear what the meaning of singular values diff between the set1 and set1_subset. And It seems same rotation and scale in this two dataset, as I assume it is affine transformation.
Any suggeation is high appreciate!

linear estimate 3d point return by linear_estimate_3d_point() is wrong as before, the svd problem. lol

About the The Factorization Method, the reconstruction has affine ambiguity,so I think it is affine transformation.And singular values diff between the set1 and set1_subset,I don't know it's meaning truly.Could you explain it particularly?
Any response is highly appreciate!

linear estimate 3d point ,I will corrected it.Maybe I need learn svd again!

estimate_RT_from_E() it is also in trouble? I cannot get right answer.
And I understand you way to derive New 3d point correspondence to image 2 now.
Any suggeation is high appreciate!

@vicdxxx
estimate_RT_from_E() is wrong. E=Udiag(1,1,0)Vt,so the svd is wrong,s should be 1,1,0.

@zyxrrr I am sorry. I forget edit 'not' in very clear...lol. I will make effort to figure out that after I understand the most part of sfm. The last step pending forever using up my patience. So I cannot see final result. I will solve that first.

E=Udiag(1,1,0)Vt ? So after U,s,VT = np.linalg.svd(E), We should discard last element of s(s[3]) first? But the value of s[3] already xxe-16, near to zero.
estimate_RT_from_E() cannot pass the unit test, because when the result of nonlinear_estimate_3d_point is negative in right pair of R,T. So sad.


Part A: Check your matrices against the example R,T

Example RT:
[[ 0.9736 -0.0988 -0.2056 0.9994]
[ 0.1019 0.9948 0.0045 -0.0089]
[ 0.2041 -0.0254 0.9786 0.0331]]

Estimated RT:
[[[ 0.98305251 -0.11787055 -0.14040758 0.99941228]
[-0.11925737 -0.99286228 -0.00147453 -0.00886961]
[-0.13923158 0.01819418 -0.99009269 0.03311219]]

[[ 0.98305251 -0.11787055 -0.14040758 -0.99941228]
[-0.11925737 -0.99286228 -0.00147453 0.00886961]
[-0.13923158 0.01819418 -0.99009269 -0.03311219]]

[[ 0.97364135 -0.09878708 -0.20558119 0.99941228]
[ 0.10189204 0.99478508 0.00454512 -0.00886961]
[ 0.2040601 -0.02537241 0.97862951 0.03311219]]

[[ 0.97364135 -0.09878708 -0.20558119 -0.99941228]
[ 0.10189204 0.99478508 0.00454512 0.00886961]
[ 0.2040601 -0.02537241 0.97862951 -0.03311219]]]

Part B: Check that the difference from expected point
is near zero

Difference: 0.00292430530369

Part C: Check that the difference from expected error/Jacobian
is near zero

Error Difference: 6.14358626835
Jacobian Difference: 1.817111972e-08

Part D: Check that the reprojection error from nonlinear method
is lower than linear method

Linear method error: 98.7354235689
Nonlinear method error: 95.5948178485

Part E: Check your matrix against the example R,T

Example RT:
[[ 0.9736 -0.0988 -0.2056 0.9994]
[ 0.1019 0.9948 0.0045 -0.0089]
[ 0.2041 -0.0254 0.9786 0.0331]]

Estimated RT:
[[ 0.97364135 -0.09878708 -0.20558119 0.99941228]
[ 0.10189204 0.99478508 0.00454512 -0.00886961]
[ 0.2040601 -0.02537241 0.97862951 0.03311219]]

It's my result.But it wasn't like that before,I didn't change any code,but the result is true now.