Closed JonathanRoiz closed 10 months ago
To fix this we will have to update all food templates. For instance, this one of canned food.
This can be done by making small cropped snapshots around the food item, such that the computer vision system are aware which food are what.
Regarding the testing steps being outdated, it would be nice to know what needs to be changed.
Are you interested in making a PR?
Sure, I can at least update the readme, and possibly update the food templates.
It looks like the templates aren't the only reason I got the error. It doesn't look like the dimension scaling works on my 3456 × 2234 macbook pro.
Sure, I can at least update the readme, and possibly update the food templates.
Would be great if you could have a crack at it!
It looks like the templates aren't the only reason I got the error. It doesn't look like the dimension scaling works on my 3456 × 2234 macbook pro.
Screen resolution should have been fixed, see issue https://github.com/andreped/super-ml-pets/issues/17#issuecomment-1510389387. But maybe it wasn't a proper fix. What are you observing to indicate that the dynamic screen resolution is not working?
If I wrote this correctly, this should scale the same way that your get_img_from_coords() method does. The image output doesn't seem to be correct.
import mss
import tkinter as tk
import numpy as np
def get_screen_scale():
template_resolution = [1920, 1080] # height, width
curr_geometry = get_curr_screen_geometry()
return np.array(curr_geometry) / np.array(template_resolution)
def get_curr_screen_geometry():
root = tk.Tk()
root.update_idletasks()
root.attributes('-fullscreen', True)
root.state('iconic')
geometry = root.winfo_geometry()
root.destroy()
return np.array(geometry.split("+")[0].split("x")).astype(int)
dimensions_scale = get_screen_scale()
coords = (450, 620, 1500, 750)
coords = np.array(coords)
coords[0] = coords[0] * dimensions_scale[0]
coords[1] = coords[1] * dimensions_scale[1]
coords[2] = coords[2] * dimensions_scale[0]
coords[3] = coords[3] * dimensions_scale[1]
coords = tuple(np.round(coords).astype(int))
with mss.mss() as sct:
sct_im = sct.grab(coords)
mss.tools.to_png(sct_im.rgb, sct_im.size, output='img.jpg')
Fixed in https://github.com/andreped/super-ml-pets/commit/5ce7b6671bc6d0d067155ea72e5c454599f4d735.
All pets and food item styles have been updated to the new, default style.
There is no longer an option to use the classic food art style.
Using the standard food art style gives the error message below.
The testing steps in the readme file are also outdated for the current version of the game.
Error log: