This is a collection of eight standalone Swift CLI tools wrapping Apple's Vision framework. Each tool is purpose-built for one detection/extraction task:
- Face detection, landmarks, quality scoring
- Barcode/QR code scanning
- Document boundary detection
- Body pose estimation
- Image classification
- OCR text extraction
Pattern: All tools follow the same I/O contract — accept file paths, PDFs, or base64 images, output unified JSON (meta, code, data). Compile individually to native binaries. Zero external dependencies beyond macOS + Xcode CLI. PDF handling built-in (renders at 300 DPI for clarity).
What's happening: This is a pragmatic toolkit for local, offline vision tasks. No API calls, no cloud dependencies, no licensing friction — just system frameworks compiled to portable binaries. Common use case: batch processing documents, scanning barcodes, extracting text, analyzing photos in workflows that can't leave the machine or hit external services.
A collection of single-purpose Swift command-line tools that run Apple's Vision framework requests on local files. Each tool:
- Compiles to a standalone binary (15–30s per tool)
- Accepts file paths, PDFs, or base64-encoded images
- Returns structured JSON (200 = results found, 404 = no results, 400 = error)
- Handles multi-page PDFs (renders each page separately)
No networking, no API calls, no third-party dependencies. Everything runs locally on macOS.
| Tool | Vision Request | Detects | Output |
|---|---|---|---|
get_live_text_enhanced_v1 |
VNRecognizeTextRequest |
OCR text | Array of text strings |
vision_face_detect_v1 |
VNDetectFaceRectanglesRequest |
Face bounding boxes | {x, y, width, height, confidence} per face |
vision_face_landmarks_v1 |
VNDetectFaceLandmarksRequest |
Face landmarks (eyes, lips, nose, contour, eyebrows) | Per-face arrays of landmark points |
vision_face_quality_v1 |
VNDetectFaceCaptureQualityRequest |
Face capture quality | {boundingBox, confidence, faceCaptureQuality} (0.0–1.0) |
vision_barcode_detect_v1 |
VNDetectBarcodesRequest |
Barcodes & QR codes | {type, payload, symbology, boundingBox, confidence} |
vision_document_detect_v1 |
VNDetectDocumentSegmentationRequest |
Document boundaries | {boundingBox, confidence, cornerPoints} |
vision_body_pose_v1 |
VNDetectHumanBodyPoseRequest |
Human body pose | Per-person keypoints with {joint, x, y, confidence} |
vision_image_classify_v1 |
VNClassifyImageRequest |
Image classification | Array of {identifier, confidence} |
swiftc vision_face_detect_v1.swift -o face_detect./face_detect photo.jpg
./face_detect document.pdf./face_detect --base64 iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==./face_detect --version{
"meta": {
"description": "tool-specific description"
},
"code": 200,
"data": [
{ "x": 0.1, "y": 0.2, "width": 0.3, "height": 0.4, "confidence": 0.95 }
]
}- code: 200 — Results found
- code: 404 — No results found
- code: 400 — Input error (file not found, invalid base64, etc.)
- macOS 10.15+ (Catalina or later)
- Xcode Command Line Tools —
xcode-select --install - Swift 5.0+ (ships with Xcode)
Expect 15–30 seconds per tool. No precompiled binaries — compilation is part of deployment.
swiftc vision_face_detect_v1.swift -o face_detect
./face_detect portrait.jpgOutput: Face bounding boxes with confidence scores.
swiftc get_live_text_enhanced_v1.swift -o ocr
./ocr invoice.pdfOutput: Text extracted from each page.
swiftc vision_barcode_detect_v1.swift -o barcode
./barcode qr_poster.pngOutput: QR code payloads and symbology types.
swiftc vision_document_detect_v1.swift -o doc_detect
./doc_detect scanned_receipt.jpgOutput: Document boundaries (corner points for perspective correction).
swiftc vision_body_pose_v1.swift -o pose
./pose person.jpgOutput: Joint keypoints (shoulders, elbows, wrists, hips, knees, ankles) with confidence.
- Face Quality: Single opaque metric (0.0–1.0). No breakdown of blur/exposure/contrast. macOS 13+ only.
- Face Landmarks: Returns
outerLipsandinnerLips, notmouth. All landmarks optional. - PDF Rendering: Pages rendered at 2x scale (300 DPI equivalent) for text clarity.
- Base64 Decoding: Supports JPEG, PNG, GIF, BMP, WebP.
- Barcode Symbology: Supports
.qr,.code128,.code39,.upce,.ean13,.ean8,.pdf417,.aztec. - Not Implemented: Object detection (requires Core ML), saliency, animal pose, hand pose, text rectangles, optical flow, homography, contour detection, object tracking.
Each tool outputs valid JSON to stdout. Redirect to a file or pipe to another process:
./face_detect photo.jpg > results.json
./face_detect photo.jpg | jq '.data[0].confidence'