play.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:party-pi 作者: JustinShenk 项目源码 文件源码
def select_mode(self):
        """ Select a mode: Easy or Hard.

        """
        self.tickcount + 1

        if self.raspberry:
            self.tickcount += 1
        bgr_image = self.capture_frame()
        # Draw "Easy" and "Hard".
        # bgr_image = self.overlayUI(bgr_image)
        easy_coord = (self.screenwidth // 8, (self.screenheight * 3) // 4)
        draw_text(easy_coord, bgr_image, "Easy", font_scale=3)
        hard_coord = (self.screenwidth // 2, (self.screenheight * 3) // 4)
        draw_text(hard_coord, bgr_image, "Hard", font_scale=3)

        # Listen for mode selection.
        if self.currPosX and self.currPosX < self.screenwidth / 2:
            cv2.rectangle(self.overlay, (0, 0), (self.screenwidth // 2,
                                                 int(self.screenheight)), (211, 211, 211), -1)
        else:
            cv2.rectangle(self.overlay, (self.screenwidth // 2, 0),
                          (self.screenwidth, self.screenheight), (211, 211, 211), -1)
        if self.click_point_x:  # If user clicks left mouse button.
            # OPTIONAL: Positional mode selection
            # self.easy_mode = True if self.click_point_x < self.screenwidth / 2
            # else False
            self.easy_mode = True
            self.tickcount = 0
            self.curr_level = 1
            self.click_point_x = None
            self.click_point_right_x = None
        if self.click_point_right_x:
            self.easy_mode = False
            self.tickcount = 0
            self.curr_level = 1
            self.click_point_x = None
            self.click_point_right_x = None

        # Draw faces.
        gray_image = cv2.cvtColor(bgr_image, cv2.COLOR_BGR2GRAY)
        faces = detect_faces(face_detection, gray_image)
        cv2.addWeighted(self.overlay, OPACITY, bgr_image,
                        1 - OPACITY, 0, bgr_image)

        if self.debug:
            for face in faces:
                draw_bounding_box(face, bgr_image, (255, 0, 0))
        # Draw Christmas logo.
        self.draw_hats(bgr_image, faces)
        self.draw_christmas_logo(bgr_image)  # Only for christmas
        # Show image.
        cv2.imshow('PartyPi', bgr_image)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号