Search code examples
matlabimage-processingcomputer-visiondepthedge-detection

find the edge based on normals


I have a 480*640 depth image, and I got the normals (a 480*640*3 matrix) of each pixel from this depth image. Does anyone know how could I find the edge based on the normal information?

Thanks a lot!


Solution

  • An intuitive definition of an edge in a depth image is where the surface normal faces away from the viewer. Assuming a viewing direction [0 0 -1] (into the XY plane) any normal that has nearly vanishing z component can be characterized as an edge.

    e = abs( depth(:,:,3) ) < 1e-3; %// a nice starting point
    

    You need to set the threshold based on your data.

    After that you might consider applying some non-maximal suppression or other morphological cleaning operations.