No description
Find a file
2026-05-01 10:26:41 +01:00
.gitignore initial v0.1 APT 2026-05-01 10:26:41 +01:00
.python-version initial v0.1 APT 2026-05-01 10:26:41 +01:00
kwin_capture_screen.cpp initial v0.1 APT 2026-05-01 10:26:41 +01:00
main.py initial v0.1 APT 2026-05-01 10:26:41 +01:00
Makefile initial v0.1 APT 2026-05-01 10:26:41 +01:00
pyproject.toml initial v0.1 APT 2026-05-01 10:26:41 +01:00
README.md initial v0.1 APT 2026-05-01 10:26:41 +01:00
reforger_queue_read.py initial v0.1 APT 2026-05-01 10:26:41 +01:00
uv.lock initial v0.1 APT 2026-05-01 10:26:41 +01:00

Anti Prestige Tool

Prototype queue-position reader for Arma Reforger.

Current State

The working script is:

python3 reforger_queue_read.py

It reads the queue number by:

  1. Cropping the queue-number region.
  2. Thresholding orange UI pixels.
  3. Splitting connected digit components.
  4. Matching digits against synthetic Roboto-Condensed templates.

No Tesseract/OpenCV/Pillow dependency is currently required.

Dataset Validation

Dataset:

/home/scootz/Pictures/codex-dataset

Validation command:

python3 reforger_queue_read.py --dataset /home/scootz/Pictures/codex-dataset --expect-filenames

Current result:

summary: 14 passed, 0 failed

The default crop is derived from this 2560x1440 reference:

reference-size: 2560x1440
reference-crop: x=1050 y=620 width=100 height=60
scale-mode: width

scale-mode=width means the crop scales uniformly from the screenshot width. This handles the current dataset better than independent width/height scaling because the dataset images are slightly shorter than 1440 pixels, while the UI coordinates still match a 1440p layout.

Real Screenshot Calibration

Dataset:

datasets/scootz-dataset

Files:

1920x1080.png
2160x1440.png  # actual image size is 2560x1440

Validation command:

python3 reforger_queue_read.py --dataset datasets/scootz-dataset --show-crop --debug

Current result:

datasets/scootz-dataset/1920x1080.png	crop=788,465,75,45
datasets/scootz-dataset/1920x1080.png	22
datasets/scootz-dataset/2160x1440.png	crop=1050,620,100,60
datasets/scootz-dataset/2160x1440.png	24

Measured digit box positions:

1440p digit bbox abs=(1080,636)-(1118,666)
1440p digit bbox rel=(0.421875,0.441667)-(0.436719,0.462500)

1080p digit bbox abs=(810,477)-(838,500)
1080p digit bbox rel=(0.421875,0.441667)-(0.436458,0.462963)

The match is exact enough to use width-scaled coordinates for normal 16:9 1080p and 1440p users.

Default search crop relative to a 2560x1440 screen:

x=1050 / 2560 = 0.410156
y=620  / 1440 = 0.430556
w=100  / 2560 = 0.039063
h=60   / 1440 = 0.041667

Resolved default crop examples:

2560x1440 -> x=1050 y=620 width=100 height=60
1920x1080 -> x=788  y=465 width=75  height=45

Single-Monitor Capture Direction

The old approach captured the whole KDE desktop across all screens. That is not ideal.

List available KWin outputs:

python3 reforger_queue_read.py --list-screens

Example output:

DP-2	enabled	0,360,1920x1080
DP-3	enabled	1920,0,2560x1440

Preferred live usage is to pass the screen containing Reforger explicitly:

python3 reforger_queue_read.py --capture --screen DP-3 --show-crop --debug

The tool first tries KWin's screen-specific screenshot API. On this machine KWin currently rejects that direct API for an untrusted process, so the tool falls back to:

  1. Capturing the full Spectacle desktop.
  2. Cropping to the requested KWin output geometry.
  3. Applying the queue-number crop inside that monitor image.

This still avoids the "wrong current monitor" problem. It does not yet avoid the temporary full-desktop screenshot in the fallback path.

The script also supports Spectacle's current-monitor capture:

python3 reforger_queue_read.py --capture

This uses:

spectacle --background --current --nonotify --output <tempfile>

That should capture only one monitor. For this to work reliably, Reforger should be focused or the relevant monitor should be the current KDE monitor.

Whole-desktop capture is still available for fallback:

python3 reforger_queue_read.py --capture --capture-mode fullscreen

Live DP-3 test result from 2026-05-01:

crop=1050,620,100,60
19

Useful Commands

Read a full single-monitor screenshot:

python3 reforger_queue_read.py --image /path/to/screenshot.png --debug

Show the crop selected for a screenshot:

python3 reforger_queue_read.py --image /path/to/screenshot.png --show-crop --debug

Read a full screenshot with an explicit crop:

python3 reforger_queue_read.py --image /path/to/screenshot.png --crop 1050,620,100,60 --debug

Read already-cropped number images:

python3 reforger_queue_read.py --dataset /path/to/cropped-digits --cropped --expect-filenames

Next Step

Get real full screenshots from the game on the actual monitor setup and validate:

python3 reforger_queue_read.py --image /path/to/real-full-screenshot.png --debug

If the default crop misses, use ImageMagick to crop around the queue value, then update --reference-crop.