Files

15 lines
460 B
Bash

#!/bin/bash
python3 - <<'EOF'
from PIL import Image
import numpy as np
im = Image.open('/mnt/f/efi/Boot/2x86.bmp').convert('RGB')
a = np.array(im).astype(int)
bg = np.array([233,233,233])
print('y: x-диапазоны не-фона в зоне x 400..530')
for y in range(440, 545):
row = a[y, 400:530]
nb = np.where(np.abs(row - bg).sum(axis=1) > 30)[0]
if len(nb):
print(f' y={y}: x {400+nb.min()}..{400+nb.max()} ({len(nb)} px)')
EOF