loupe

Computer vision from the command line, using native OS APIs. Face detection, OCR, barcode and QR scanning, image classification, background removal, facial landmarks, body and hand pose estimation. No external services, no dependencies.

loupe faces photo.jpg                          # detect faces
loupe faces --blur -o blurred.jpg photo.jpg    # blur faces
loupe ocr screenshot.png                       # extract text
loupe ocr --literal code.png                   # no dictionary correction
loupe ocr --words receipt.jpg                  # one line per word, with its box
loupe barcode label.png                        # scan barcodes
loupe classify photo.jpg                       # scene/object labels
loupe cutout -o subject.png photo.jpg          # remove the background

Built in Zig, wrapping the macOS Vision framework and Windows WinRT APIs. All commands support --json. Also builds as a C-compatible shared library.

New in 0.6

loupe ocr --words returns one result per word instead of one per line, each with its line number and bounding box. Use it when where the text sits matters: rebuilding the rows of a receipt or a table, or finding the position of one word on screen. macOS only.

$ loupe ocr --words receipt.jpg
0	0.0565	0.0565	0.1358	0.0587	Corner
0	0.1964	0.0606	0.1615	0.0594	Grocery
1	0.0543	0.1269	0.0789	0.0654	221

The columns are line, x, y, width, height and text, tab-separated, with coordinates as fractions of the image measured from the top left. --json gives the same data as objects. It combines with --literal.

New in 0.5

All commands

Command What it does
faces Detect faces. -o extracts them, --blur and --redact hide them
ocr Recognize text. --literal skips dictionary correction, --words gives a box per word
barcode, qr Scan barcodes, or QR codes only
aruco Detect ArUco fiducial markers. --dict restricts to one dictionary
classify Label scenes and objects, from 1,300+ labels
landmarks Facial feature points: eyes, nose, mouth, jawline
body, hands Skeleton and finger joint positions
animals Detect cats and dogs
rectangles Detect rectangular shapes
horizon Measure image tilt
saliency Find the regions that draw the eye. --objects for objectness
score Aesthetic quality score (macOS 15+)
segment Person segmentation mask. -o saves it as a grayscale PNG
cutout Remove the background, keeping the subject (macOS 14+)

On Windows, faces and ocr are available. The rest are macOS only.

Install

# macOS / Linux
brew install georgemandis/tap/loupe

# Windows
scoop bucket add georgemandis https://github.com/georgemandis/scoop-bucket
scoop install loupe

Read More

Recipes