27 lines
822 B
Bash
27 lines
822 B
Bash
#!/bin/bash
|
|
python3 - <<'EOF'
|
|
from PIL import Image
|
|
import numpy as np
|
|
|
|
for name, path in (('x86-1','/mnt/f/efi/Boot/1x86.bmp'), ('x86-2','/mnt/f/efi/Boot/2x86.bmp')):
|
|
im = Image.open(path).convert('RGB'); a = np.array(im).astype(int)
|
|
print('==', name)
|
|
for y in (484, 488, 492, 496):
|
|
row = a[y]
|
|
nb = np.abs(row - np.array([233,233,233])).sum(axis=1) > 30
|
|
# runs
|
|
runs = []
|
|
i = 0
|
|
while i < len(nb):
|
|
if nb[i]:
|
|
j = i
|
|
while j < len(nb) and nb[j]: j += 1
|
|
runs.append((i, j-1))
|
|
i = j
|
|
else:
|
|
i += 1
|
|
# только крупные
|
|
big = [r for r in runs if r[1]-r[0] > 3]
|
|
print(f' y={y}: ' + ', '.join(f'{r[0]}..{r[1]}' for r in big[:6]))
|
|
EOF
|