{"id":1532,"url":"https://github.com/yangKJ/Harbeth","last_synced_at":"2025-08-06T13:32:51.774Z","repository":{"id":40490454,"uuid":"177693714","full_name":"yangKJ/Harbeth","owner":"yangKJ","description":"🎨 GPU accelerated image / video and camera filter library based on Metal. Support macOS \u0026 iOS. 图像、视频、相机滤镜框架","archived":false,"fork":false,"pushed_at":"2024-11-21T06:52:26.000Z","size":58467,"stargazers_count":512,"open_issues_count":3,"forks_count":74,"subscribers_count":13,"default_branch":"master","last_synced_at":"2024-11-21T07:34:04.591Z","etag":null,"topics":["camera","coreimage","filter","graphics","image","metal","video","vr"],"latest_commit_sha":null,"homepage":"","language":"Metal","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yangKJ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["yangKJ"],"buy_me_a_coffee":"yangkj3102","custom":["https://raw.githubusercontent.com/yangKJ/Harbeth/master/Screenshot/WechatIMG2.jpg","https://raw.githubusercontent.com/yangKJ/Harbeth/master/Screenshot/WechatIMG1.jpg"]}},"created_at":"2019-03-26T01:39:06.000Z","updated_at":"2024-11-21T07:28:10.000Z","dependencies_parsed_at":"2023-09-22T16:42:19.194Z","dependency_job_id":"1593d0f1-0ba4-4fe3-967e-f49b01c87d96","html_url":"https://github.com/yangKJ/Harbeth","commit_stats":{"total_commits":431,"total_committers":2,"mean_commits":215.5,"dds":"0.42691415313225056","last_synced_commit":"ccefd20cdd1e43657b584954fa17e58ff813021e"},"previous_names":["yangkj/atmetalband"],"tags_count":131,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yangKJ%2FHarbeth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yangKJ%2FHarbeth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yangKJ%2FHarbeth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yangKJ%2FHarbeth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yangKJ","download_url":"https://codeload.github.com/yangKJ/Harbeth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228905516,"owners_count":17989778,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["camera","coreimage","filter","graphics","image","metal","video","vr"],"created_at":"2024-01-05T20:15:49.091Z","updated_at":"2024-12-09T14:31:06.934Z","avatar_url":"https://github.com/yangKJ.png","language":"Metal","funding_links":["https://github.com/sponsors/yangKJ","https://buymeacoffee.com/yangkj3102","https://raw.githubusercontent.com/yangKJ/Harbeth/master/Screenshot/WechatIMG2.jpg","https://raw.githubusercontent.com/yangKJ/Harbeth/master/Screenshot/WechatIMG1.jpg","https://github.com/sponsors/yangKJ?frequency=one-time\u0026sponsor=yangKJ","https://www.buymeacoffee.com/yangkj3102"],"categories":["Media","Libs"],"sub_categories":["Image","Images"],"readme":"# Harbeth\n\n| Animated | Still |\n| :---: | :---: |\n|\u003cimg width=230px src=\"https://raw.githubusercontent.com/yangKJ/Harbeth/master/Screenshot/Soul.gif\" /\u003e|\u003cimg width=230px src=\"https://raw.githubusercontent.com/yangKJ/Harbeth/master/Screenshot/Mix2.png\" /\u003e|\n\n[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-brightgreen.svg?style=flat\u0026colorA=28a745\u0026\u0026colorB=4E4E4E)](https://github.com/yangKJ/Harbeth)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/Harbeth.svg?style=flat\u0026label=Harbeth\u0026colorA=28a745\u0026\u0026colorB=4E4E4E)](https://cocoapods.org/pods/Harbeth)\n[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/OpencvQueen.svg?style=flat\u0026label=OpenCV\u0026colorA=28a745\u0026\u0026colorB=4E4E4E)](https://cocoapods.org/pods/OpencvQueen)\n![Platform](https://img.shields.io/badge/Platforms-iOS%20%7C%20macOS%20%7C%20watchOS-4E4E4E.svg?colorA=28a745)\n \n[**Harbeth**](https://github.com/yangKJ/Harbeth) is a high performance Swift library for GPU accelerated image processing and realtime camera capture and video smooth playback, and then add filters based on Metal, and also compatible for CoreImage filters and using Metal performance shaders filters.\n\nThis library is highly inspired by [GPUImage](https://github.com/BradLarson/GPUImage).\n\n-------\n\nEnglish | [**简体中文**](README_CN.md)\n\n## Features\n🟣 At the moment, the most important features of metal moudle can be summarized as follows:\n\n- Support more platform system, macOS and iOS, both UIKit/AppKit and SwiftUI.\n- High performance quickly add filters at these sources:    \n  - UIImage, NSImage, CIImage, CGImage, CMSampleBuffer, CVPixelBuffer.\n- The built-in metal kernel filters is roughly divided into the following modules:    \n  - [Blend](https://github.com/yangKJ/Harbeth/tree/master/Sources/Compute/Blend), [Blur](https://github.com/yangKJ/Harbeth/tree/master/Sources/Compute/Blur), [Pixel](https://github.com/yangKJ/Harbeth/tree/master/Sources/Compute/Pixel), [Coordinate](https://github.com/yangKJ/Harbeth/tree/master/Sources/Compute/Coordinate), [Lookup](https://github.com/yangKJ/Harbeth/tree/master/Sources/Compute/Lookup), [Matrix](https://github.com/yangKJ/Harbeth/tree/master/Sources/Compute/Matrix), [Shape](https://github.com/yangKJ/Harbeth/tree/master/Sources/Compute/Shape), [Generator](https://github.com/yangKJ/Harbeth/tree/master/Sources/Compute/Generator).\n- Setup [MetalPerformanceShaders](https://github.com/yangKJ/Harbeth/tree/master/Sources/MPS) filters And also compatible for [CoreImage](https://github.com/yangKJ/Harbeth/tree/master/Sources/CoreImage) filters.\n- Previews and rendering backed with the power of Metal.\n- Drop-in support for your own custom filters using [LUTs](https://github.com/yangKJ/Harbeth/tree/master/Sources/Compute/Lookup/C7LookupTable.swift) or using [Cube](https://github.com/yangKJ/Harbeth/tree/master/Sources/CoreImage/CIColorCube.swift).\n- Realtime camera capture and video smooth playback with filters.\n- Video source processing video file by [Kakapos](https://github.com/yangKJ/Kakapos) library.\n\n#### **A total of 100+ kinds of built-in filters are currently available.✌️**\n\n## Requirements\n\n| iOS Target | macOS Target | Xcode Version | Swift Version |\n|:---:|:---:|:---:|:---:|\n| iOS 10.0+ | macOS 10.13+ | Xcode 10.0+ | Swift 5.0+ |\n\n## Usage\n\n\u003cp align=\"left\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/yangKJ/Harbeth/master/Screenshot/ShiftGlitch.gif\" width=35% hspace=\"1px\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/yangKJ/Harbeth/master/Screenshot/EdgeGlow.gif\" width=35% hspace=\"15px\"\u003e\n\u003c/p\u003e\n\n### Image\n\n- 🎷 Code zero intrusion add filter function for image.\n\n```\nlet filter1 = C7ColorMatrix4x4(matrix: Matrix4x4.Color.sepia)\nlet filter2 = C7Granularity(grain: 0.8)\nlet filter3 = C7SoulOut(soul: 0.7)\n\nlet filters = [filter1, filter2, filter3]\n\n// Use:\nlet dest = HarbethIO.init(element: originImage, filters: filters)\n// Synchronize do something..\nImageView.image = try? dest.output()\n\n// OR Use:\nImageView.image = try? originImage.makeGroup(filters: filters)\n\n// OR Use:\nImageView.image = originImage.filtering(filter1, filter2, filter3)\n\n// OR Use Operator:\nImageView.image = originImage -\u003e\u003e filter1 -\u003e\u003e filter2 -\u003e\u003e filter3\n```\n\n- Asynchronous do something..\n\nThis performance is the best. 🚗🚗\n\n```\nlet dest = HarbethIO.init(element: ``Source``, filter: ``filter``)\n\ndest.transmitOutput(success: { [weak self] image in\n    // do something..\n})\n```\n\n### ImageView\n\n- Just use the [RenderImageView](https://github.com/yangKJ/Harbeth/blob/master/Sources/Basic/Outputs/RenderImageView.swift) and set the filters.\n\n```\n// It's used the same way as NSImageView.\nlet renderView = RenderImageView.init(image: originImage)\n\nrenderView.filters = [C7Storyboard(ranks: 2)]\n```\n\n### Camera\n\n- 📸 Camera capture generates pictures.\n\n```\n// Add an edge detection filter:\nlet filter = C7EdgeGlow(lineColor: .red)\n\n// Generate camera collector:\nlet camera = C7CollectorCamera.init(delegate: self)\ncamera.captureSession.sessionPreset = AVCaptureSession.Preset.hd1280x720\ncamera.filters = [filter]\n\nextension CameraViewController: C7CollectorImageDelegate {\n    func preview(_ collector: C7Collector, fliter image: C7Image) {\n        // do something..\n    }\n}\n```\n\n### Video\n\n- 📺 Local video or Network video are simply apply with filters.\n  - 🙄 For details, See [PlayerViewController](https://github.com/yangKJ/Harbeth/blob/master/Demo/Harbeth-iOS-Demo/Modules/PlayerViewController.swift).\n  - You can also extend this by using [HarbethIO](https://github.com/yangKJ/Harbeth/blob/master/Sources/Basic/Outputs/HarbethIO.swift) to filter the collected `CVPixelBuffer`.\n\n```\nlazy var video: C7CollectorVideo = {\n    let videoURL = URL.init(string: \"Link\")!\n    let asset = AVURLAsset.init(url: videoURL)\n    let playerItem = AVPlayerItem.init(asset: asset)\n    let player = AVPlayer.init(playerItem: playerItem)\n    let video = C7CollectorVideo.init(player: player, delegate: self)\n    let filter = C7ColorMatrix4x4(matrix: Matrix4x4.Color.sepia)\n    video.filters = [filter]\n    return video\n}()\n\nself.video.play()\n\nextension PlayerViewController: C7CollectorImageDelegate {\n    func preview(_ collector: C7Collector, fliter image: C7Image) {\n        // do something..\n    }\n}\n```\n\n### SwiftUI Support\n- For the direct use [HarbethView](https://github.com/yangKJ/Harbeth/blob/master/Sources/SwiftUI/HarbethView.swift), it is just a simple implementation.\n- The SwiftUI API is still in-progress and may not be production ready. We're looking for help! 🤲\n\n```\nlet filters: [C7FilterProtocol] = [\n    CIHighlight(highlight: intensity),\n    C7WaterRipple(ripple: intensity),\n]\nHarbethView(image: inputImage, filters: filters, content: { image in\n    image.resizable()\n        .aspectRatio(contentMode: .fit)\n})\n```\n\n### CocoaPods\n\n- If you want to import [**Metal**](https://github.com/yangKJ/Harbeth) module, you need in your Podfile: \n\n```\npod 'Harbeth'\n```\n\n- If you want to import [**OpenCV**](https://github.com/yangKJ/OpencvQueen) image module, you need in your Podfile: \n\n```\npod 'OpencvQueen'\n```\n\n### Swift Package Manager\n\n[Swift Package Manager](https://swift.org/package-manager/) is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.\n\n\u003e Xcode 11+ is required to build [Harbeth](https://github.com/yangKJ/Harbeth) using Swift Package Manager.\n\nTo integrate Harbeth into your Xcode project using Swift Package Manager, add it to the dependencies value of your `Package.swift`:\n\n```swift\ndependencies: [\n    .package(url: \"https://github.com/yangKJ/Harbeth.git\", branch: \"master\"),\n]\n```\n\n### Remarks\n\n\u003e The general process is almost like this, the Demo is also written in great detail, you can check it out for yourself.🎷\n\u003e\n\u003e [**HarbethDemo**](https://github.com/yangKJ/Harbeth)\n\u003e\n\u003e Tip: If you find it helpful, please help me with a star. If you have any questions or needs, you can also issue.\n\u003e\n\u003e Thanks.🎇\n\n### About the author\n- 🎷 **E-mail address: [yangkj310@gmail.com](yangkj310@gmail.com) 🎷**\n- 🎸 **GitHub address: [yangKJ](https://github.com/yangKJ) 🎸**\n\nBuy me a coffee or support me on [GitHub](https://github.com/sponsors/yangKJ?frequency=one-time\u0026sponsor=yangKJ).\n\n\u003ca href=\"https://www.buymeacoffee.com/yangkj3102\"\u003e\n\u003cimg width=25% alt=\"yellow-button\" src=\"https://user-images.githubusercontent.com/1888355/146226808-eb2e9ee0-c6bd-44a2-a330-3bbc8a6244cf.png\"\u003e\n\u003c/a\u003e\n\nAlipay or WeChat. Thanks.\n\n\u003cp align=\"left\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/yangKJ/Harbeth/master/Screenshot/WechatIMG1.jpg\" width=30% hspace=\"1px\"\u003e\n\u003cimg src=\"https://raw.githubusercontent.com/yangKJ/Harbeth/master/Screenshot/WechatIMG2.jpg\" width=30% hspace=\"15px\"\u003e\n\u003c/p\u003e\n\n-----\n\n### License\nHarbeth is available under the [MIT](LICENSE) license. See the [LICENSE](LICENSE) file for more info.\n\n-----\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FyangKJ%2FHarbeth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FyangKJ%2FHarbeth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FyangKJ%2FHarbeth/lists"}