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 legend to splice tool #795

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tools/bag_processing/scripts/rosbag_splice.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,17 @@ def select_splice_timestamps_and_splice_bag(bagfile, image_topic):
window = "image"
cv2.namedWindow(window)
cv2.moveWindow(window, 40, 30)

# Define the legend text and its position
legend_text = "d: next | a: previous | w: next 10 | s: previous 10 | q: quit | p: print | space: split | u: remove splice| enter: splice"
position = (10, 30) # Position (x, y) of the text on the image

# Define font, scale, color, and thickness
font = cv2.FONT_HERSHEY_SIMPLEX
font_scale = 0.67
color = (255, 255, 255) # White color in BGR
thickness = 2

print_string = True
while True:
msg = (msg_tuples[i])[0]
Expand All @@ -155,6 +166,17 @@ def select_splice_timestamps_and_splice_bag(bagfile, image_topic):
image = bridge.imgmsg_to_cv2(msg, msg.encoding)
except (CvBridgeError) as e:
print(e)
# Add the legend text to the image
cv2.putText(
image,
legend_text,
position,
font,
font_scale,
color,
thickness,
cv2.LINE_AA,
)
cv2.imshow(window, image)
cv2.setWindowTitle(window, msg_info_string)
key = cv2.waitKey(0)
Expand Down
Loading