feat: LCD kit (segment digits, bars, fonts)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
1 parent
afd649acc5
commit
36e01c4b1c
11 files changed
+448
No files matched your search
@@ -0,0 +1,9 @@
|
||||
import numpy as np
|
||||
from PIL import Image
|
||||
|
||||
|
||||
def count_colour(img: Image.Image, colour, box=None) -> int:
|
||||
"""Number of pixels of `colour` in `img` (optionally only inside `box`)."""
|
||||
if box is not None:
|
||||
img = img.crop(box)
|
||||
return int((np.asarray(img.convert("RGB")) == np.array(colour)).all(axis=2).sum())
|
||||
Reference in new issue
Block a user