Beispiel #1
0
    def check_one_color(self):
        if len(self.colors_to_check) == 0:
            self.save_answer()
            return

        color_to_check = self.colors_to_check.pop()

        self.gui.configure(bg=_from_rgb(self.colors[color_to_check]))
        self.gui.update()

        time.sleep(0.5)

        image = self.provider.get_pil_image()
        image.save("runData/" + color_to_check + ".bmp")
        map_box = Positions.get("cam_minimap_ul") + Positions.get(
            "cam_minimap_lr")

        new_rgb = (_get_mean_rgb(image.crop(map_box)))
        self.corrected_colors[color_to_check] = new_rgb

        print(color_to_check)
        print("old rgb:", self.colors[color_to_check])
        print("new rgb:", new_rgb)

        self.gui.after(50, self.check_one_color)
Beispiel #2
0
    def get_pil_image(self):
        if self.reapeat_window:
            return Image.open("window.bmp")

        r, frame = self.vid.read()
        ul = Positions.get("cam_tibia_window_ul")
        lr = Positions.get("cam_tibia_window_lr")

        return Image.fromarray(cv2.cvtColor(frame,
                                            cv2.COLOR_BGR2RGB)).crop(ul + lr)
Beispiel #3
0
    def update(self):
        self.latest_input_image = self._img_provider.get_pil_image()

        map_box = Positions.get("cam_minimap_ul") + Positions.get(
            "cam_minimap_lr")
        self.minimap.update(self.latest_input_image.crop(map_box))