Skip to content

Instantly share code, notes, and snippets.

@Merwanski
Last active February 17, 2022 00:45
Show Gist options
  • Save Merwanski/52950e4d1752ca7aedb050b879bf6d9d to your computer and use it in GitHub Desktop.
Save Merwanski/52950e4d1752ca7aedb050b879bf6d9d to your computer and use it in GitHub Desktop.
replace cv bridge
# You could use numpy directly, instead of cv_bridge
import numpy as np
im = np.frombuffer(image_data.data, dtype=np.uint8).reshape(image_data.height, image_data.width, -1)
pi
# Another solution // Still not yet tested
# Beautiful solution is to use ros_numpy (https://github.com/eric-wieser/ros_numpy).
# It is similar to the function of cv_bridge, but without the dependency on cv2:
import ros_numpy
np_img = ros_numpy.numpify(ros_img_msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment