wb-08 / PokerVision

Recognition of all entities on the poker table and added analytics on the basis of which you can make decisions about your moves
35 stars 16 forks source link

Calibrating elements positions in the capture #5

Closed noeldum closed 3 months ago

noeldum commented 4 months ago

This seem to have been designed for when pokerstars is running under wine I believe?

I connect from ubuntu to a virtual windows os with RDP. So basically the window control with wmctrl does not work for me here. I will have to tell PokerVision where the absolute origin of the window is. I sort of managed to do that but it comes with errors and I suspect all calibrated positions (cards, pot, stacks etc) are off certainly due to the fact that I am not able (yet) to resize the window to what PokerVision needs.

Are there any debugging available to help calibrating what position is where? How did you do this at dev time? Can we dump individual images somewhere to view them and correct positions maybe? I might have to place some img.save() in the code to help with this.

I take I definitely need to set the pokerstars table to what it is set in PokerVision? width=1090 and height=900. If not then the template won't be scaled to this sizing? Or does it not matter at all and I can just use whatever table size and adjust each element positions?

noeldum commented 3 months ago

I made a quick transparent jig to help position the window using tkinter. It is here below. Simple and helpful.

from utils import read_config_file
config = read_config_file()
import tkinter as tk

def crect(element, color):
    canvas.create_rectangle(config[element]['x_0'], config[element]['y_0'], config[element]['x_1'], config[element]['y_1'], outline=color)

def cpoint(x, y, color):
    canvas.create_line(x-5, y, x+5, y, fill=color)
    canvas.create_line(x, y-5, x, y+5, fill=color)

root = tk.Tk()
root.title("pvjig")
root.wait_visibility(root)
root.wm_attributes("-alpha", 0.5)

canvas = tk.Canvas(root, width=config['table_size']['width'], height=config['table_size']['height'], bg="white")
canvas.pack()

# main outline
canvas.create_rectangle(1, 1, config['table_size']['width']-1, config['table_size']['height']-1, width=2, outline='red')

# elements
crect('hero_step_define', 'blue')
crect('hero_cards', 'blue')
crect('table_cards', 'blue')
crect('pot', 'blue')

cpoint(config['player_center_coordinates'][1][0], config['player_center_coordinates'][1][1], 'red')
cpoint(config['player_center_coordinates'][2][0], config['player_center_coordinates'][2][1], 'red')
cpoint(config['player_center_coordinates'][3][0], config['player_center_coordinates'][3][1], 'red')
cpoint(config['player_center_coordinates'][4][0], config['player_center_coordinates'][4][1], 'red')
cpoint(config['player_center_coordinates'][5][0], config['player_center_coordinates'][5][1], 'red')
cpoint(config['player_center_coordinates'][6][0], config['player_center_coordinates'][6][1], 'red')

canvas.create_rectangle(config['players_coordinates'][1][0], config['players_coordinates'][1][1], config['players_coordinates'][1][2], config['players_coordinates'][1][3], width=2, outline='red')
canvas.create_rectangle(config['players_coordinates'][2][0], config['players_coordinates'][2][1], config['players_coordinates'][2][2], config['players_coordinates'][2][3], width=2, outline='red')
canvas.create_rectangle(config['players_coordinates'][3][0], config['players_coordinates'][3][1], config['players_coordinates'][3][2], config['players_coordinates'][3][3], width=2, outline='red')
canvas.create_rectangle(config['players_coordinates'][4][0], config['players_coordinates'][4][1], config['players_coordinates'][4][2], config['players_coordinates'][4][3], width=2, outline='red')
canvas.create_rectangle(config['players_coordinates'][5][0], config['players_coordinates'][5][1], config['players_coordinates'][5][2], config['players_coordinates'][5][3], width=2, outline='red')
canvas.create_rectangle(config['players_coordinates'][6][0], config['players_coordinates'][6][1], config['players_coordinates'][6][2], config['players_coordinates'][6][3], width=2, outline='red')

canvas.create_rectangle(config['players_bet'][2][0], config['players_bet'][2][1], config['players_bet'][2][2], config['players_bet'][2][3], width=2, outline='green')
canvas.create_rectangle(config['players_bet'][3][0], config['players_bet'][3][1], config['players_bet'][3][2], config['players_bet'][3][3], width=2, outline='green')
canvas.create_rectangle(config['players_bet'][4][0], config['players_bet'][4][1], config['players_bet'][4][2], config['players_bet'][4][3], width=2, outline='green')
canvas.create_rectangle(config['players_bet'][5][0], config['players_bet'][5][1], config['players_bet'][5][2], config['players_bet'][5][3], width=2, outline='green')
canvas.create_rectangle(config['players_bet'][6][0], config['players_bet'][6][1], config['players_bet'][6][2], config['players_bet'][6][3], width=2, outline='green')

root.mainloop()

It looks like I need to reposition all elements in the config file as nearly nothing match for my case. Even after scaling to the default set by PokerVision.

wb-08 commented 3 months ago

This seem to have been designed for when pokerstars is running under wine I believe?

I connect from ubuntu to a virtual windows os with RDP. So basically the window control with wmctrl does not work for me here. I will have to tell PokerVision where the absolute origin of the window is. I sort of managed to do that but it comes with errors and I suspect all calibrated positions (cards, pot, stacks etc) are off certainly due to the fact that I am not able (yet) to resize the window to what PokerVision needs.

Are there any debugging available to help calibrating what position is where? How did you do this at dev time? Can we dump individual images somewhere to view them and correct positions maybe? I might have to place some img.save() in the code to help with this.

I take I definitely need to set the pokerstars table to what it is set in PokerVision? width=1090 and height=900. If not then the template won't be scaled to this sizing? Or does it not matter at all and I can just use whatever table size and adjust each element positions?

what is the problem with installing pokerstars on ubuntu?

noeldum commented 3 months ago

it's not just Pokerstars. There is also the tracker and other GTO tools which are all designed to work together on windoze (alas!). Much easier to have all them on the OS they are designed for. Also I have no time to spend on wine.

I am sorted out more or less now with this project I think.