mlboydaisuke commited on
Commit
d60a497
Β·
verified Β·
1 Parent(s): 612833d

gen-cards: regenerate Use-it block

Browse files
Files changed (1) hide show
  1. README.md +40 -0
README.md CHANGED
@@ -27,6 +27,46 @@ DPT-style head. Drop in an RGB image, get a depth map (and a confidence map). No
27
  host post-processing is just a colormap.
28
 
29
  <!-- gen-cards:use-it begin id=depth-anything-3-small (managed by scripts/gen-cards β€” edit cards.json / QuickStart.swift, not this block) -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
30
  <!-- gen-cards:use-it end -->
31
 
32
  ## Bundles
 
27
  host post-processing is just a colormap.
28
 
29
  <!-- gen-cards:use-it begin id=depth-anything-3-small (managed by scripts/gen-cards β€” edit cards.json / QuickStart.swift, not this block) -->
30
+ ## Use it
31
+
32
+ ▢️ **Run it (source)** β€” the [DepthCamera runner](https://github.com/john-rocky/coreai-kit/tree/main/Examples/DepthCamera)
33
+ (live camera depth, one app for every depth model in the catalog):
34
+
35
+ ```bash
36
+ git clone https://github.com/john-rocky/coreai-kit
37
+ open coreai-kit/Examples/DepthCamera/DepthCamera.xcodeproj
38
+ # β†’ Run, then pick "Depth Anything 3 Small" in the model picker
39
+
40
+ # agents / headless (macOS):
41
+ cd coreai-kit/Examples/DepthCamera
42
+ swift run depth-cli --model depth-anything-3-small --image sample.jpg --output depth.png
43
+ ```
44
+
45
+ πŸ’» **Build with it** β€” complete; the glue is kit API, copy-paste runs:
46
+
47
+ ```swift
48
+ import CoreAIKitVision
49
+
50
+ let estimator = try await DepthEstimator(catalog: "depth-anything-3-small")
51
+ let image = try ImageFile.load(imageURL) // any image file β†’ CGImage + EXIF orientation
52
+ let depth = try await estimator.estimateDepth(for: image.cgImage)
53
+ // depth: DepthMap β€” .cgImage() renders it, .values are the raw floats
54
+ ```
55
+
56
+ The take-home is [`Examples/DepthCamera/Sources/QuickStart.swift`](https://github.com/john-rocky/coreai-kit/blob/main/Examples/DepthCamera/Sources/QuickStart.swift)
57
+ β€” this exact code as one typed function, no UI; the CLI is an argument shell over it, and
58
+ the GUI runs the same estimator on every camera frame (`CameraFeed`, ~10 lines).
59
+ Live camera? `CameraFeed` (kit API) streams frames β€” feed each one to
60
+ `estimateDepth(for:)`; the camera permission prompt is your app's own chrome.
61
+
62
+ **Integration checklist**
63
+
64
+ - SPM: `https://github.com/john-rocky/coreai-kit` β†’ product **CoreAIKitVision**
65
+ - Info.plist: `NSCameraUsageDescription` β€” only for the live camera; the snippet needs none
66
+ - Entitlements: none needed
67
+ - First run downloads the model β€” 0.1 GB (Mac) / 0.1 GB (iPhone) β€” then it loads from the
68
+ local cache (Application Support; progress via the `downloadProgress` callback)
69
+ - Measure in Release β€” Debug is ~3Γ— slower on per-token host work
70
  <!-- gen-cards:use-it end -->
71
 
72
  ## Bundles