forked from LASR-at-Home/Base
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from MBTMBTMBT/12_6
Message Change
- Loading branch information
Showing
6 changed files
with
124 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
To send numpy arrays with messages. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import numpy as np | ||
|
||
|
||
def numpy2message(np_array: np.ndarray) -> list[bytes, list[int], str]: | ||
data = np_array.tobytes() | ||
shape = list(np_array.shape) | ||
dtype = str(np_array.dtype) | ||
return data, shape, dtype | ||
|
||
|
||
def message2numpy(data:bytes, shape:list[int], dtype:str) -> np.ndarray: | ||
array_shape = tuple(shape) | ||
array_dtype = np.dtype(dtype) | ||
|
||
deserialized_array = np.frombuffer(data, dtype=array_dtype) | ||
deserialized_array = deserialized_array.reshape(array_shape) | ||
|
||
return deserialized_array | ||
|
7 changes: 7 additions & 0 deletions
7
common/vision/lasr_vision_msgs/srv/TorchFaceFeatureDetection.srv
This file contains 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
This file contains 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
This file contains 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
This file contains 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