forked from HiroIshida/detic_ros
-
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.
* Define custom service * Add request handler * Turn off pubsub * Add client example * Enable loading custom image
- Loading branch information
1 parent
eea02b0
commit 29fe219
Showing
6 changed files
with
63 additions
and
5 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
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,28 @@ | ||
#!/usr/bin/env python3 | ||
import argparse | ||
import cv_bridge | ||
import cv2 | ||
import rospy | ||
from cv_bridge import CvBridge | ||
from sensor_msgs.msg import Image | ||
from detic_ros.srv import DeticSeg | ||
import matplotlib.pyplot as plt | ||
|
||
if __name__ == '__main__': | ||
parser = argparse.ArgumentParser() | ||
parser.add_argument('-image', type=str, help='input image path') | ||
args = parser.parse_args() | ||
image = cv2.imread(args.image) | ||
assert image is not None | ||
|
||
rospy.init_node('example_client') | ||
rospy.wait_for_service('/docker/detic_segmentor/segment_image') | ||
image_msg = CvBridge().cv2_to_imgmsg(image, encoding='passthrough') | ||
|
||
f = rospy.ServiceProxy('/docker/detic_segmentor/segment_image', DeticSeg) | ||
resp = f(image_msg) | ||
seg_info = resp.seg_info | ||
if resp.debug_image is not None: | ||
image = CvBridge().imgmsg_to_cv2(resp.debug_image) | ||
plt.imshow(image) | ||
plt.show() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
sensor_msgs/Image image | ||
--- | ||
detic_ros/SegmentationInfo seg_info | ||
sensor_msgs/Image debug_image |