AI Poker Recognized Hand Producer
================================

This package moves camera capture and card recognition out of the browser.
Run it on the machine that has the two USB cameras attached.

Files:
- ai_player_3_producer.py
- config.example.yml
- requirements.txt

Recommended setup:
1. Use Python 3.10+ on the camera machine.
2. Install dependencies:
   python -m pip install -r requirements.txt
3. Copy the example config:
   cp config.example.yml config.yml
4. Calibrate both feeds:
   python ai_player_3_producer.py --config config.yml --calibrate
5. Run the live producer:
   python ai_player_3_producer.py --config config.yml

Shortcut:
- Use `./setup_and_run.sh --calibrate` once.
- Then use `./setup_and_run.sh` to launch the producer.
- The script creates `.venv`, installs requirements, and prompts for the publish token if config.yml still has the placeholder.

Calibration:
- The app opens one feed at a time.
- Click 4 points around the full card zone in this order:
  top-left, top-right, bottom-right, bottom-left
- Press S to save that feed and continue.
- Press U to undo the last point.
- Press R to reset the current feed.
- Press Q or Esc to abort.

Run mode keys:
- Q or Esc: quit
- P: pause or resume publishing

Practical guidance:
- Keep each feed tight on its zone. The hole-card feed should mostly show the two hold cards.
- The board feed should mostly show the board cards, not the entire table.
- Lock focus if your webcam supports it.
- Reduce glare. Even lighting matters more than raw brightness.
- If the preview shows boxes but not card names, move the camera closer before changing thresholds.

Notes:
- The current producer uses calibrated ROI rectification plus local template recognition.
- It now publishes directly to ai.pokertimer.io at /api/state.
- Set server.publish_token in config.yml to the write token configured on the server.
- The website page https://ai.pokertimer.io becomes the observer dashboard for the published state.
