I was able to narrow down what appeared to be an error in our calculations of the points on the back plane. It turns out I was write, and indeed it was an error in our lambda calculation.
The lambda calculation is in the following format:
lambda = (n^t(point_on_plane - camera_origin))/(n^t(image_point))
We can use the plane origin as the point in the plane and (0,0,1) as the plane normal vector. We know the camera origin and calculated the image point.
What we were doing is converting the world pieces to camera coordinates. This is a PROBLEM, because we are converting a normal vector while treating it as a point, using RP+T to convert it to world coordinates. Wednesday, I had the idea of converting things to world coordinates instead, allowing me to use the normal vector. I converted both the image point and the camera origin to world coordinates. I thought I had a breakthrough, obtaining a z-coordinate of zero. However, the numbers didn't look quite right. I used my graphing calculator to do matrix multiplications for checking things. I finally left around 9:45 Wednesday night.
Thursday I was hoping to get it! I felt I may be on the right track (after looking at my calculator some more at home Wednesday night). But I wasn't getting very far. Then I started looking at the lambda calculation and associated geometrical pieces. I realized something and started working it out on the whiteboard and was gratified by my calculator producing the correct answer. Here is what it was: lambda*u is a ray, NOT a 3D point. The 3D point is origin + lambda*u; this must be converted to world all at once. This comes out as the following: R^t*origin + lambda*R^t*u + R^t*T. I then applied the same ray-plane equation and resolved for lambda. I went through the calculations, and when I got lambda, I converted back to camera, divided the x and y by z, and verified that they matched the image point coordinates. BINGO! I made changes to the code as needed, rescanned, and I got not only perpendicularity of the planes, but also got 3D curvature of a scanned coffee cup (there is some noise, but that's likely expected). It's about time :)
Other happenings: Grady merged his branch from serial and all our code is back in one repo. Tyler implemented the progress bar (it shows up but has some bugs to work out) and destructors (these are not all correctly working yet...some of them are commented out until Tyler can look at them more).
We plan to meet Saturday. Hopefully we can get everything working on all three computers (e.g. updated serial lib and files, includes in VS) and continue making headway. Grady is/will be looking at pulsewidth modulation; hopefully he can do it in time and we can have a smoother motion with our motor. Tyler will work on the progress bar and destructors more. And I will continue working on the scan, likely working to disclude the plane points from the scan (things that have z~0) leaving the object as the primary piece.
In all, Thursday was a good day. We have a presentation next Thursday that will take some time to prepare for, but I'm feeling better about the project overall now that the scanning bug is fixed. Hopefully we'll even reduce the noise in the scan if possible.
Until next time...
UPDATE (4/5/13):
Here is what a scan of the coffee cup on its side now looks like:
No comments:
Post a Comment