Skip to content

Commit e4af7aa

Browse files
committed
fix image
1 parent 94e39f7 commit e4af7aa

File tree

1 file changed

+12
-13
lines changed
  • formant_ros2_adapter/scripts/components/subscriber

1 file changed

+12
-13
lines changed

formant_ros2_adapter/scripts/components/subscriber/ingester.py

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# from cv_bridge import CvBridge
2-
# import cv2
1+
from cv_bridge import CvBridge
2+
import cv2
33
import grpc
44
from typing import Dict
55
from sensor_msgs.msg import (
@@ -51,7 +51,7 @@
5151
class Ingester:
5252
def __init__(self, _fclient: Client):
5353
self._fclient = _fclient
54-
# self.cv_bridge = CvBridge()
54+
self.cv_bridge = CvBridge()
5555
self._logger = get_logger()
5656

5757
def ingest(
@@ -124,17 +124,16 @@ def ingest(
124124
)
125125

126126
elif msg_type == Image:
127-
self._logger.info("ROS IMAGE UNSUPPORTED")
128127
# Convert Image to a Formant image
129-
# cv_image = self.cv_bridge.imgmsg_to_cv2(msg, "bgr8")
130-
# encoded_image = cv2.imencode(".jpg", cv_image)[1].tobytes()
131-
132-
# self._fclient.post_image(
133-
# stream=formant_stream,
134-
# value=encoded_image,
135-
# tags=tags,
136-
# timestamp=msg_timestamp,
137-
# )
128+
cv_image = self.cv_bridge.imgmsg_to_cv2(msg, "bgr8")
129+
encoded_image = cv2.imencode(".jpg", cv_image)[1].tobytes()
130+
131+
self._fclient.post_image(
132+
stream=formant_stream,
133+
value=encoded_image,
134+
tags=tags,
135+
timestamp=msg_timestamp,
136+
)
138137

139138
elif msg_type == CompressedImage:
140139
# Post the compressed image

0 commit comments

Comments
 (0)