Closed nishantsnair closed 2 years ago
Yeah sorry, this is not an official Zivid code-sample unfortunately, so there is no guarantee that it will work. So far the function "custom_feature_points()" only exists in an internal version of the SDK. It has not been released (yet).
Is it possible to just get that function? I think I have everything else already.
Maybe that is too much to ask. Even a description of that method might be useful. I can work on my own implementation.
I could give you the Python function, but it would not work because the back-end does not exist in any version of the SDK.
Anyway, there is a way forward for you, but it would require some implementation on your part. I assume you intended to do the following two-step procedure:
detection_result_a = zivid.calibration.custom_feature_points(features_a)
etcSince I can't make the first point work for you, you'd have to replace both yourself. What you can do is find (or implement) an algorithm for calculating the so-called "rigid transform" between two sets of feature points. That should give you essentially the same functionality. If you google that you should be able to find something.
Hi, as you recommended a little over a year ago I found a rigid 3D transform here: https://github.com/nghiaho12/rigid_transform_3D/blob/master/test_rigid_transform_3D.py the function def _get_transform() in /zivid_turntable/calibration.py was rewritten to:
def _get_transform( marker_set_a: Dict[int, ArucoMarker], marker_set_b: Dict[int, ArucoMarker] ) -> np.ndarray:
features_a, features_b = _get_common_feature_points(
marker_set_a, marker_set_b)
rot, tran = rigid_transform_3D(
features_a.transpose(), features_b.transpose())
affine = np.zeros((4, 4))
affine[:3, :3] = rot[:,:3]
affine[:3, 3] = tran[:, 0]
affine[3, 3] = 1
return affine
The result though is very wrong can you help me spot any differences between what I am doing and what the internal sdk methods are. Also are these now available to the public?
Hi @nishantsnair ! I don't have time to look into details at the moment, but I have a quick idea for you to check: It could be that this rigid transform function you found is defined in the opposite direction. Can you try one of these things?:
features_a.transpose(), features_b.transpose()
.
or
- Swap the order of
features_a.transpose(), features_b.transpose()
. or- Invert your affine transform before returning it.
That was easy :) it works now! a night of sleepless debugging and this was it!
Running your code in 'process_data.py' with some pcd's I have collected with arucos I get an error when the code tries to determine the transform from feature_a to feature_b with in line 80:
detection_result_a = zivid.calibration.custom_feature_points(features_a)
line 81:detection_result_b = zivid.calibration.custom_feature_points(features_b)
incalibration.py
the error is
AttributeError: module 'zivid.calibration' has no attribute 'custom_feature_points'
. This makes sense since inzivid.calibration
there is adetect_feature_points
method but nocustom_feature_points
. Can you please help