Skip to content

Commit

Permalink
fix: update incorrect cvtColor option #43
Browse files Browse the repository at this point in the history
  • Loading branch information
kel-z committed Dec 19, 2023
1 parent 73c298b commit 362f46d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/models/game_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@

class GameData:
"""GameData class for storing and accessing game data"""

is_trailblazer_female = True
sro_mappings = None

Expand Down Expand Up @@ -87,9 +88,9 @@ def __init__(self) -> None:
base64_string = data["mini_icons"][key]
decoded_image = base64.b64decode(base64_string)
img = Image.open(BytesIO(decoded_image))
img = cv2.cvtColor(np.array(img), cv2.COLOR_BGRA2RGB)
img = cv2.cvtColor(np.array(img), cv2.COLOR_RGBA2RGB)

# Circle mask
# # Circle mask
mask = np.zeros(img.shape[:2], dtype="uint8")
(h, w) = img.shape[:2]
cv2.circle(mask, (int(w / 2), int(h / 2)), 50, 255, -1)
Expand Down Expand Up @@ -144,6 +145,14 @@ def get_equipped_character(self, equipped_avatar_img: Image) -> str:
equipped_avatar_img = np.array(equipped_avatar_img)
equipped_avatar_img = cv2.resize(equipped_avatar_img, (100, 100))

# Circle mask
mask = np.zeros(equipped_avatar_img.shape[:2], dtype="uint8")
(h, w) = equipped_avatar_img.shape[:2]
cv2.circle(mask, (int(w / 2), int(h / 2)), 50, 255, -1)
equipped_avatar_img = cv2.bitwise_and(
equipped_avatar_img, equipped_avatar_img, mask=mask
)

max_conf = 0
character = ""

Expand Down

0 comments on commit 362f46d

Please sign in to comment.