Commit f7b13fc8 authored by Barcis, Michal's avatar Barcis, Michal

displaying GUI with no incomming messages

parent bcba197a
......@@ -34,6 +34,9 @@ CUSTOM_QOS = QoSProfile(
)
SAVE_IMAGES = False
class CameraSubscriber(Node, MissionExecutor):
def __init__(self):
super().__init__('camera_subscriber')
......@@ -78,7 +81,8 @@ class CameraSubscriber(Node, MissionExecutor):
int(np.ceil(hosts_num / int(np.sqrt(hosts_num))))
)
self.images = np.zeros(self.shape + self.resolution)
self.display_streams()
self.create_timer(1, self.display_streams)
self.camera_subscriptions = [
self.create_subscription(
......@@ -209,7 +213,7 @@ class CameraSubscriber(Node, MissionExecutor):
value=(0, 0, 2 * red[r, c]))
h, w, _ = img.shape
y0 = r * (sp_height+pad_top) + title_pad
x0 = c * (sp_width+pad) # + pad//2
x0 = c * (sp_width+pad) # + pad//2
frame[y0:y0+h, x0:x0+w] = img
frame = cv2.putText(
......@@ -232,15 +236,18 @@ class CameraSubscriber(Node, MissionExecutor):
f'{fps[r,c]} FPS',
(x0, y0+sp_height - 10),
cv2.FONT_HERSHEY_DUPLEX,
3, ((1 - 2 * red[r,c]), (1 - 3 * red[r,c]), 1),
3, ((1 - 2 * red[r, c]), (1 - 3 * red[r, c]), 1),
thickness=3,
)
now = datetime.now().timestamp()
if now - self.last_saved > 5:
if now - self.last_saved > 5 and SAVE_IMAGES:
print('saving')
frame2 = frame.copy() * 255
cv2.imwrite(f'/home/agniewek/longTemp/infdist/img{datetime.now()}.jpg', frame2)
cv2.imwrite(
f'/home/agniewek/longTemp/infdist/img{datetime.now()}.jpg',
frame2
)
self.saved += 1
self.last_saved = now
frame = cv2.resize(frame, (frame.shape[1]//2, frame.shape[0]//2))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment