Skip to content

Commit

Permalink
Fixed visualizer
Browse files Browse the repository at this point in the history
  • Loading branch information
DupuisB authored and Pbatch committed Jul 8, 2024
1 parent 45fb2dd commit 1e4f1f1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ build/
__pycache__/
*.pyc
clashroyalebuildabot/debug
clashroyalebuildabot/emulator/platform-tools
clashroyalebuildabot/emulator/platform-tools
env/
7 changes: 2 additions & 5 deletions clashroyalebuildabot/visualizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def __init__(self):
self.font = ImageFont.load_default()
self.unit_names = [unit["name"] for unit in list(NAME2UNIT.values())]
cv2.namedWindow("Visualizer", cv2.WINDOW_NORMAL)
logger.info("Visualizer initialized.")


def _draw_text(self, d, bbox, text, rgba=(0, 0, 0, 255)):
Expand Down Expand Up @@ -74,10 +75,6 @@ def annotate_image(self, image, state):

def run(self, image, state):
annotated_image = self.annotate_image(image, state)
# Convert PIL image to a NumPy array explicitly
annotated_image = np.array(annotated_image)
# Ensure the window is initialized
cv2.imshow("Visualizer", cv2.cvtColor(annotated_image, cv2.COLOR_RGB2BGR))
#Log the window size
logger.info(f"Visualizer window size: {cv2.getWindowImageRect('Visualizer')}")
cv2.waitKey(0)
cv2.waitKey(1)
Binary file added platform-tools-latest-windows.zip
Binary file not shown.

0 comments on commit 1e4f1f1

Please sign in to comment.