zivid / zivid-python

Official Python package for Zivid 3D cameras
BSD 3-Clause "New" or "Revised" License
40 stars 14 forks source link

Allow construction of Matrix4x4 directly from Pose #195

Closed eskaur closed 1 year ago

eskaur commented 1 year ago

Functions such as DetectionResult.pose() return a Pose, not a numpy array. The user may want to save this pose to file, which could only be done by:

zivid.Matrix4x4(pose.to_matrix()).save("mypose.yml")

This commit makes the process easier by enabling:

zivid.Matrix4x4(pose).save("mypose.yml")
apartridge commented 1 year ago

If we change this then we should also change the C++ API to make a Matrix4x4 ctor that takes a pose, for consistency? (Also .NET possibly)? And I am not sure if that is correct thing to do since Matrix4x4 is a more basic primitive than a Pose, so Matrix should not know too much about Pose's?

The first code line (existing code) did not feel like too much coding?

eskaur commented 1 year ago

If we change this then we should also change the C++ API to make a Matrix4x4 ctor that takes a pose, for consistency? (Also .NET possibly)? And I am not sure if that is correct thing to do since Matrix4x4 is a more basic primitive than a Pose, so Matrix should not know too much about Pose's?

The first code line (existing code) did not feel like too much coding?

You make good points. This was merely a mockup because the feature was requested by CSU. I am fine with not merging this :)