Esempio n. 1
0
    def draw_stickers(self, frame, stickers, offset_x, offset_y):
        """Draws the given stickers onto the given frame."""
        index = -1
        for row in range(3):
            for col in range(3):
                index += 1
                x1 = (offset_x + STICKER_AREA_TILE_SIZE *
                      col) + STICKER_AREA_TILE_GAP * col
                y1 = (offset_y + STICKER_AREA_TILE_SIZE *
                      row) + STICKER_AREA_TILE_GAP * row
                x2 = x1 + STICKER_AREA_TILE_SIZE
                y2 = y1 + STICKER_AREA_TILE_SIZE

                # shadow
                cv2.rectangle(frame, (x1, y1), (x2, y2), (0, 0, 0), -1)

                # foreground color
                cv2.rectangle(
                    frame, (x1 + 1, y1 + 1), (x2 - 1, y2 - 1),
                    ColorDetector.get_prominent_color(stickers[index]), -1)