Getting the normals with python API

General Information

  • Product: e.g. B57-4
  • Serial Number: 245363
  • Ensenso SDK Version: 4.0.1502
  • Operating System: Windows

Problem / Question

I’m trying to get the normals map but cannot find the API in python. I would expect something similar to camera.get_point_map() but can’t find it…

That’s right, there is currently no convenience function for the normals. You have to fall back to the normal JSON API and execute the ComputeNormals command before loading the data from the Normals node.

Assuming the Camera object camera with serial number serial the necessary code should look something like this (untested):

# After camera.compute_point_map():

with NxLibCommand(CMD_COMPUTE_NORMALS) as cmd:
        cmd.parameters()[ITM_CAMERAS] = serial
        cmd.execute()

normals = camera[ITM_IMAGES][ITM_NORMALS]

Hi Daniel,
thanks for the information.
We’ll try it out.
Best regards,
Stefaan