Last active
February 17, 2022 00:45
-
-
Save Merwanski/52950e4d1752ca7aedb050b879bf6d9d to your computer and use it in GitHub Desktop.
replace cv bridge
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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