Skip to content

A Real-Time ML Powered Segmentation Library for SwiftUI.

Notifications You must be signed in to change notification settings

PittsCraft/EdgeSegmentation-Demo

Repository files navigation

EdgeSegmentation ✂️

A Real-Time ML Powered Segmentation Library for SwiftUI.

Overview

  • SwiftUI components to integrate segmentation prompt and display seamlessly (iOS 17)
  • tools to perform segmentation programmatically (iOS 15)

Backed on EdgeSAM

➡️ Full Documentation ➡️ Demo Repository

demo_edge_segmentation_480.mov

Features

  • All-in-one ✨ fully customizable segmentation prompt view
  • Segment:
    • drawing a box 📦
    • tapping to add inclusion ✅ and exclusion ❌ points
    • without any extra controls
  • Drag to share cropped segmentation ✉️
  • Zoom to position points precisely 🔍
  • Customizable segmentation overlay displaying path 🎨
  • Customizable edition decorations 👨‍🎨
  • Fit / fill image display 🏞️

➕ Full control to implement specific behaviors or exotic UI needs thanks to a high modularity 👌

Code snippets

  • Segmentation editor with ability to drag to share
SegmentationEditor(image: image, draggableSegmentation: true)
  • Segmentation editor with feedback through binding
@State var segmentation: Segmentation?

func body() -> some View {
   SegmentationEditor(image: image, segmentation: $segmentation)
}
  • Segmentation display (no edition)
SegmentationView(image: image, segmentation: segmentation)
  • Programmatic segmentation
let segmentor = Segmentor(image: image)
try await segmentor.processImage()

let input = SegmentationInput(positive: [inclusionPoint], negative: [exclusionPoint], box: CGRect(origin: somePoint, size: someSize))
let segmentation = try await segmentor.segmentation(for: input)
// Access CGPath for any display ratio, compute cropped segmentation image...

Contact me for more information

About

A Real-Time ML Powered Segmentation Library for SwiftUI.

Topics

Resources

Stars

Watchers

Forks

Languages