I am using PCA and it works when the point cloud is anything but perfect grid. For example when my point cloud is a perfect grid resting on XZ plane (Y is up), then my matrix returns this:
[7149.85, 0 ,2.28882e-005]
[0, 0, 0]
[2.28882e-005, 0, 13602.7]
Then I invert this matrix:
[0.000139863, 0, -2.35336e-013]
[-0, 0, 0]
[-2.35336e-013, 0, 7.35146e-005]
I find the largest eigen vector using the second matrix but since the determinant is 0, it doesn't work.
How can I handle these cases? Or am I doing it incorrectly where these cases are not special and should still yield correct results using the same algorithm?
In comparison my SVD implementation using numpy works every time but I want to implement it using PCA.
Thanks.