def __init__(self, player: Player, screen: pygame.surface.Surface):
     self.image = load_image("hp.png", screen)
     self.screen = screen
     self.player = player
     self.rect = pygame.rect.Rect(845, 25, self.image.get_width(),
                                  self.image.get_height())
     self.space = 5
 def __init__(self, x: int, y: int, screen: pygame.surface.Surface,
              image_filename: str):
     # инициализация интерфейса для общения с кнопкой
     self.image = load_image(image_filename, screen)
     self.screen = screen
     self.x, self.y = x, y
     self.rect = pygame.rect.Rect(x, y, self.image.get_width(),
                                  self.image.get_height())
Esempio n. 3
0
 def sign_process(self, ch, method, props, body):
     try:
         ch.basic_ack(delivery_tag=method.delivery_tag)
         self.log.info(method.routing_key + ' received message')
         image = load_image(body)
         cv2.imshow(self.sign_window, image)
         cv2.waitKey(1)
     except Exception as err:
         self.log.error(err)
Esempio n. 4
0
 def process(self, ch, method, props, body):
     try:
         ch.basic_ack(delivery_tag=method.delivery_tag)
         self.log.info(method.routing_key + ' received message')
         image = load_image(body)
         image = self.truck.dashboard(image)
         data = cv2.imencode('.jpg', image)[1].tostring()
         self.mq.publish(MQ.COMP_RESPONSE, data)
     except Exception as err:
         self.log.error(err)
Esempio n. 5
0
 def process(self, ch, method, props, body):
     try:
         ch.basic_ack(delivery_tag=method.delivery_tag)
         self.log.info(method.routing_key + ' received message')
         image = load_image(body)
         result = self.model.detect([image], verbose=1)[0]
         image = self.draw_result(image, result)
         data = cv2.imencode('.jpg', image)[1].tostring()
         self.mq.publish(MQ.OBST_RESPONSE, data)
     except Exception as err:
         self.log.error(err)
Esempio n. 6
0
 def process(self, ch, method, props, body):
     try:
         ch.basic_ack(delivery_tag=method.delivery_tag)
         self.log.info(method.routing_key + ' received message')
         image = cv2.cvtColor(load_image(body), cv2.COLOR_BGR2RGB)
         x = transform(image)[0]
         x.unsqueeze_(0)
         result = self.model(x)[:2]
         image = self.draw_result(image, result)
         data = cv2.imencode('.jpg', image)[1].tostring()
         self.mq.publish(MQ.LANE_RESPONSE, data)
     except Exception as err:
         self.log.error(err)
    def __init__(self):
        self.size = self.width, self.height = 1000, 1000
        self.screen = pygame.display.set_mode(self.size)
        self.screen.blit(load_image("background.png", self.screen), (0, 0))
        main_font = pygame.font.Font(os.path.join("res", "sw_font.ttf"), 45)
        text = main_font.render("SCORE", True, pygame.Color("#FFD700"))
        self.x, self.y = self.width // 4 + self.width // 6, self.height // 4 + self.height // 20
        self.screen.blit(text, (self.x, self.y))
        self.file = "score.txt"

        pygame.draw.rect(self.screen, pygame.Color("#FFD700"),
                         ((self.width // 4, self.height // 4),
                          (self.width // 2, self.height // 2)), 5)
Esempio n. 8
0
 def __init__(self, x: int, y: int, screen: pygame.surface.Surface,
              *groups):
     super().__init__(*groups)
     columns = 4
     rows = 3
     self.last_update = pygame.time.get_ticks()
     self.cur_frame = 1
     self.last_update = 0
     self.frames = []
     self.sheet = load_image(name="explosion.jpg",
                             screen=screen,
                             colorkey=-1)
     self.rect = pygame.Rect(0, 0,
                             self.sheet.get_width() // columns,
                             self.sheet.get_height() // rows)
     for j in range(rows):
         for i in range(columns):
             frame_location = (self.rect.w * i, self.rect.h * j)
             self.frames.append(
                 self.sheet.subsurface(
                     pygame.Rect(frame_location, self.rect.size)))
     self.image = self.frames[self.cur_frame]
     self.rect = self.rect.move(x, y)
 def __init__(self, screen: pygame.surface.Surface, static: bool = True):
     self.screen = screen
     self.image = load_image("background.png", self.screen)
     self.static = static
     self.y = 0
Esempio n. 10
0
 def get_image(self,
               screen: pygame.surface.Surface) -> pygame.surface.Surface:
     return load_image("player.png", screen)
Esempio n. 11
0
 def get_image(self,
               screen: pygame.surface.Surface) -> pygame.surface.Surface:
     return pygame.transform.scale(load_image("medkit.png", screen),
                                   (50, 50))
Esempio n. 12
0
 def process(self, ch, method, props, body):
     self.log.info(method.routing_key + ' received message')
     image = load_image(body)
     cv2.imshow('image', image)
     cv2.waitKey()