Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add marker detection and hand-eye API wrappers #276

Merged
merged 1 commit into from
Jun 28, 2024

Conversation

johningve
Copy link
Contributor

This commit adds API wrappers for the SDK 2.13 fiducial marker detection and hand-eye calibration.

Added to the zivid.calibration module are the classes MarkerShape, MarkerDictionary, and DetectionResultFiducialMarkers, as well as the function detect_markers. The DetectionResultFiducialMarkers class can be used to construct a HandEyeInput, just like DetectionResult.

The hand-eye test data was updated with some newer ZDFs that were downsampled to save on Git LFS bandwidth.

@johningve johningve changed the base branch from master to MISC-2024-06-27-update-to-sdk-2.13.0 June 27, 2024 13:06
@johningve johningve force-pushed the MISC-2024-06-25-marker-detection-and-handeye branch from 63286a7 to 0e13146 Compare June 27, 2024 13:07
@johningve johningve marked this pull request as ready for review June 27, 2024 13:07
@johningve johningve requested a review from a team as a code owner June 27, 2024 13:07
@johningve johningve force-pushed the MISC-2024-06-25-marker-detection-and-handeye branch 2 times, most recently from 5a9db06 to 1d7d1ee Compare June 27, 2024 13:42
Base automatically changed from MISC-2024-06-27-update-to-sdk-2.13.0 to master June 27, 2024 13:42
@johningve johningve force-pushed the MISC-2024-06-25-marker-detection-and-handeye branch 3 times, most recently from cdf26c8 to 2377821 Compare June 27, 2024 14:23
vawale
vawale previously approved these changes Jun 27, 2024
@johningve johningve force-pushed the MISC-2024-06-25-marker-detection-and-handeye branch 2 times, most recently from eedda83 to 84dff92 Compare June 28, 2024 07:57
@torbsorb
Copy link
Contributor

Please consider changing the format of corners_in_pixel_coordinates in order to simplify the following (which is currently required):

rgba = camera_frame.point_cloud().copy_data("rgba")
rgb = rgba[:, :, :3].copy().astype(np.uint8)
if marker_list is not None:
    detected_markers = detection_result.detected_markers()
    detected_corners = [
        np.array(marker.corners_in_pixel_coordinates).reshape((4, 1, 2))
        for marker in detected_markers
    ]
    marker_ids = np.array([marker.id for marker in detected_markers])
    rgb = cv2.aruco.drawDetectedMarkers(rgb, detected_corners, marker_ids, [0, 255, 0])

@johningve
Copy link
Contributor Author

@eskaur @Frontier789 could you advise on this?

@johningve johningve force-pushed the MISC-2024-06-25-marker-detection-and-handeye branch from 84dff92 to adf54d8 Compare June 28, 2024 08:22
@johningve
Copy link
Contributor Author

Do we have the same issue in C++ then? Or is this just a problem in python?

@eskaur
Copy link
Member

eskaur commented Jun 28, 2024

Do we have the same issue in C++ then? Or is this just a problem in python?

In C++ we return our own special types (std::arrayZivid::PointXY,4), so the user has to do some conversion before passing it to OpenCV anyway. Therefore I don't consider this an issue in C++. In python it becomes more tempting to be super compatible with 3rd party APIs since we return universal stuff like lists and numpy arrays.

@johningve johningve force-pushed the MISC-2024-06-25-marker-detection-and-handeye branch from adf54d8 to 0baa19f Compare June 28, 2024 08:31
@eskaur
Copy link
Member

eskaur commented Jun 28, 2024

Working on making the corner getters return numpy arrays.

@eskaur eskaur force-pushed the MISC-2024-06-25-marker-detection-and-handeye branch from 0baa19f to de0ae4d Compare June 28, 2024 09:12
@johningve johningve force-pushed the MISC-2024-06-25-marker-detection-and-handeye branch 4 times, most recently from caae349 to 21385fd Compare June 28, 2024 13:51
This commit adds API wrappers for the SDK 2.13 fiducial marker detection
and hand-eye calibration.

Added to the `zivid.calibration` module are the classes `MarkerShape`,
`MarkerDictionary`, and `DetectionResultFiducialMarkers`, as well as the
function `detect_markers`. The `DetectionResultFiducialMarkers` class
can be used to construct a `HandEyeInput`, just like `DetectionResult`.

The hand-eye test data was updated with some newer ZDFs that were
downsampled to save on Git LFS bandwidth.

Co-authored-by: Eskil Aursand <[email protected]>
@johningve johningve force-pushed the MISC-2024-06-25-marker-detection-and-handeye branch from 21385fd to 320f539 Compare June 28, 2024 13:53
@johningve johningve merged commit a2ae070 into master Jun 28, 2024
21 checks passed
@johningve johningve deleted the MISC-2024-06-25-marker-detection-and-handeye branch June 28, 2024 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants