def load_lightbulb(self):
     RED_PATH = os.path.join('images', 'red.jpg')
     GREEN_PATH = os.path.join('images', 'green.jpg')
     assert os.path.isfile(RED_PATH), '[ERROR] Path not exist: {}'.format(RED_PATH)
     assert os.path.isfile(GREEN_PATH), '[ERROR] Path not exist: {}'.format(GREEN_PATH)
     red = cv2.imread(RED_PATH)
     green = cv2.imread(GREEN_PATH)
     self.red_qimg = convert_qimg(red, win_width = 50, win_height = 50)
     self.green_qimg = convert_qimg(green, win_width = 50, win_height = 50)
Exemple #2
0
 def display_pixmap(self, frame_store, img_type):
     if img_type == 'rgb':
         qimg = convert_qimg(frame_store.rgb_img)
         self.rgb_label.setPixmap(QtGui.QPixmap.fromImage(qimg))
     if img_type == 'rgb2':
         qimg = convert_qimg(frame_store.rgb_img)
         self.rgb2_label.setPixmap(QtGui.QPixmap.fromImage(qimg))
     else:
         self.seg_qimg = convert_qimg(frame_store.seg_out)
         #qimg = convert_qimg(frame_store.seg_out)
         self.seg_label.setPixmap(QtGui.QPixmap.fromImage(self.seg_qimg))
 def display_pixmap(self, frame_store, img_type):
     """
     input:
         frame_store -- FrameStore instance
         img_type -- str, 'rgb', 'depth' or 'seg'
     """
     assert img_type in ['rgb', 'seg'], 'WRONG ARGUMENT img_type'
     if img_type == 'rgb':
         qimg = convert_qimg(frame_store.rgb_img)
         self.rgb_label.setPixmap(QtGui.QPixmap.fromImage(qimg))
     else:
         self.seg_qimg = convert_qimg(frame_store.seg_out)
         self.seg_label.setPixmap(QtGui.QPixmap.fromImage(self.seg_qimg))
 def update_third_layer(self, frame_store):
     """
     update obstacle avoidance (frame + summary)
     """
     obj_tup, obj_img = run_avoidance(frame_store.d1_img, frame_store.pred_idx, 
                                      depth_threshold = 1000, visible_width = 30)
     # convert to uint8 is important!
     obj_img = np.uint8(obj_img)
     qimg = convert_qimg(obj_img, win_width = 620, win_height = 360, is_gray = True)
     # update frame on left
     self.obj_frame.setPixmap(QPixmap.fromImage(qimg))
     # update summary on right
     if obj_tup[1] is None:
         self.obj_name.setText('NA')
         self.obj_dist.setText('NA')
         # raise green alarm
         self.lightbulb.setPixmap(QPixmap.fromImage(self.green_qimg))
     else:
         obj_name = self.names[obj_tup[1] + 1]
         # translate pixel value to meter
         meter = obj_tup[2] * self.depth_scale
         self.obj_name.setText(obj_name)
         self.obj_dist.setText('{0:.1f} cm'.format(meter * 100))
         # raise red alarm
         self.lightbulb.setPixmap(QPixmap.fromImage(self.red_qimg))
Exemple #5
0
    def update_lightbulb(self):
        from pyqt_utils import convert_qimg
        import cv2
        from PyQt5.QtGui import QPixmap

        img = cv2.imread(os.path.join('..', 'images', 'green.jpg'))
        qimg = convert_qimg(img, win_width = 50, win_height = 50)
        self.lightbulb.setPixmap(QPixmap.fromImage(qimg))
 def update_second_layer(self, frame_store):
     """
     update segmentation result and scene summary
     """
     # update segmentation result
     qimg = convert_qimg(frame_store.pred_rgb, win_width = 620, win_height = 360)
     self.seg_frame.setPixmap(QPixmap.fromImage(qimg))
     # update scene summary
     grid_dict = scene_summarize(frame_store.pred_idx, 
                                 self.mat, self.names,
                                 threshold = 900)
     self.update_scene_summary(grid_dict)
 def display_pixmap(self, frame_store, img_type):
     """
     input:
         frame_store -- FrameStore instance
         img_type -- str, 'rgb', 'depth' or 'seg'
     """
     assert img_type in ['rgb', 'depth', 'seg'], 'WRONG ARGUMENT img_type'
     if img_type == 'rgb':
         qimg = convert_qimg(frame_store.rgb_img)
         self.rgb_label.setPixmap(QtGui.QPixmap.fromImage(qimg))
     elif img_type == 'depth':
         frame_store.d1_img = np.uint8(frame_store.d1_img)
         if len(frame_store.d1_img.shape) == 2:
             is_gray = True
         else:
             is_gray = False
         qimg = convert_qimg(frame_store.d1_img * 30, is_gray=is_gray)
         # store depth 1-channel map for distance query
         self.depth_label.setPixmap(QtGui.QPixmap.fromImage(qimg))
     else:
         self.seg_qimg = convert_qimg(frame_store.pred_rgb)
         #self.seg_pixmap = QtGui.QPixmap.fromImage(qimg)
         self.seg_label.setPixmap(QtGui.QPixmap.fromImage(self.seg_qimg))
Exemple #8
0
 def update_pixmap(self):
     qimg1 = convert_qimg(self.data1, win_width = 620, win_height = 360)        
     qimg2 = convert_qimg(self.data2, win_width = 620, win_height = 360)
     self.seg_frame.setPixmap(QPixmap.fromImage(qimg1))
     self.obj_frame.setPixmap(QPixmap.fromImage(qimg2))