0

I'm having a depth image, say z = f(x, y) with (x, y) in pixels. I want to calculate the normal vector at each pixel to create the normal map.

I've been trying the approach at Calculate surface normals from depth image using neighboring pixels cross product. In this approach, basically the "input" to the cross product is two tangent vectors, which are the gradients (dz/dx) and (dy/dx). These two tangent vectors will form the tangent plane at point (x, y, f(x, y)), and then the cross product will find the normal vector to this plane.

However, I don't understand why the normal vector to this plane (3D plane (x, y, f(x, y)) will also be the normal vector to the plane in world coordinates that I'm trying to find. Is there any assumption here? How can this approach be used to find the normal vector at each pixel?

  • How would you find the normal vector ? –  May 01 '19 at 12:31
  • Basically, I ask because that tangent plane is the tangent plane to the depth 3D graph of the depth function (x, y, f(x, y)), not the tangent plane to the real world point. – SparklesLeet May 01 '19 at 14:23
  • In what way does this answer my question ? –  May 01 '19 at 14:58
  • I'm voting to close this question as off-topic because it is not a programming question...it's a math or 3D geometry question not bound even to a 3D library or any discussion of code. – CryptoFool May 02 '19 at 04:03

1 Answers1

1

That is almost by definition of the normal to a surface. The normal is locally perpendicular to the tangent plane. And the cross-product of two non-collinear vectors is a vector that is perpendicular to the two vectors. That is why the cross-product of two non-collinear vectors of the tangent plane is perpendicular to that tangent plane. And thus it is along the normal direction.

lrineau
  • 6,036
  • 3
  • 34
  • 47
  • Basically, I ask because that tangent plane is the tangent plane to the depth 3D graph of the depth function (x, y, f(x, y)), not the tangent plane to the real world point. – SparklesLeet May 01 '19 at 14:22