-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Knightro63:main' into main
- Loading branch information
Showing
186 changed files
with
9,175 additions
and
17 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,132 @@ | ||
# Miscellaneous | ||
*.class | ||
*.lock | ||
*.log | ||
*.pyc | ||
*.swp | ||
.DS_Store | ||
.atom/ | ||
.buildlog/ | ||
.history | ||
.svn/ | ||
|
||
# IntelliJ related | ||
*.ipr | ||
*.iws | ||
.idea/ | ||
|
||
# Visual Studio Code related | ||
.classpath | ||
.project | ||
.settings/ | ||
.vscode/* | ||
|
||
# Flutter repo-specific | ||
/bin/cache/ | ||
/bin/internal/bootstrap.bat | ||
/bin/internal/bootstrap.sh | ||
/bin/mingit/ | ||
/dev/benchmarks/mega_gallery/ | ||
/dev/bots/.recipe_deps | ||
/dev/bots/android_tools/ | ||
/dev/devicelab/ABresults*.json | ||
/dev/docs/doc/ | ||
/dev/docs/flutter.docs.zip | ||
/dev/docs/lib/ | ||
/dev/docs/pubspec.yaml | ||
/dev/integration_tests/**/xcuserdata | ||
/dev/integration_tests/**/Pods | ||
/packages/flutter/coverage/ | ||
version | ||
analysis_benchmark.json | ||
|
||
# packages file containing multi-root paths | ||
.packages.generated | ||
|
||
# Flutter/Dart/Pub related | ||
**/doc/api/ | ||
.dart_tool/ | ||
.flutter-plugins | ||
.flutter-plugins-dependencies | ||
**/generated_plugin_registrant.dart | ||
.packages | ||
.pub-preload-cache/ | ||
.pub/ | ||
build/ | ||
flutter_*.png | ||
linked_*.ds | ||
unlinked.ds | ||
unlinked_spec.ds | ||
|
||
# Android related | ||
**/android/**/gradle-wrapper.jar | ||
.gradle/ | ||
**/android/captures/ | ||
**/android/gradlew | ||
**/android/gradlew.bat | ||
**/android/local.properties | ||
**/android/**/GeneratedPluginRegistrant.java | ||
**/android/key.properties | ||
*.jks | ||
|
||
# iOS/XCode related | ||
**/ios/**/*.mode1v3 | ||
**/ios/**/*.mode2v3 | ||
**/ios/**/*.moved-aside | ||
**/ios/**/*.pbxuser | ||
**/ios/**/*.perspectivev3 | ||
**/ios/**/*sync/ | ||
**/ios/**/.sconsign.dblite | ||
**/ios/**/.tags* | ||
**/ios/**/.vagrant/ | ||
**/ios/**/DerivedData/ | ||
**/ios/**/Icon? | ||
**/ios/**/Pods/ | ||
**/ios/**/.symlinks/ | ||
**/ios/**/profile | ||
**/ios/**/xcuserdata | ||
**/ios/.generated/ | ||
**/ios/Flutter/.last_build_id | ||
**/ios/Flutter/App.framework | ||
**/ios/Flutter/Flutter.framework | ||
**/ios/Flutter/Flutter.podspec | ||
**/ios/Flutter/Generated.xcconfig | ||
**/ios/Flutter/ephemeral | ||
**/ios/Flutter/app.flx | ||
**/ios/Flutter/app.zip | ||
**/ios/Flutter/flutter_assets/ | ||
**/ios/Flutter/flutter_export_environment.sh | ||
**/ios/ServiceDefinitions.json | ||
**/ios/Runner/GeneratedPluginRegistrant.* | ||
|
||
# macOS | ||
**/Flutter/ephemeral/ | ||
**/Pods/ | ||
**/macos/Flutter/GeneratedPluginRegistrant.swift | ||
**/macos/Flutter/ephemeral | ||
**/xcuserdata/ | ||
|
||
# Windows | ||
**/windows/flutter/generated_plugin_registrant.cc | ||
**/windows/flutter/generated_plugin_registrant.h | ||
**/windows/flutter/generated_plugins.cmake | ||
|
||
# Linux | ||
**/linux/flutter/generated_plugin_registrant.cc | ||
**/linux/flutter/generated_plugin_registrant.h | ||
**/linux/flutter/generated_plugins.cmake | ||
|
||
# Coverage | ||
coverage/ | ||
|
||
# Symbols | ||
app.*.symbols | ||
|
||
# Exceptions to above rules. | ||
!**/ios/**/default.mode1v3 | ||
!**/ios/**/default.mode2v3 | ||
!**/ios/**/default.pbxuser | ||
!**/ios/**/default.perspectivev3 | ||
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages | ||
!/dev/ci/**/Gemfile.lock | ||
!.vscode/settings.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
## 0.0.1 | ||
|
||
* Initial release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2023 John Sparkman. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
# apple\_vision\_image\_depth | ||
|
||
[![Pub Version](https://img.shields.io/pub/v/apple_vision_image_depth)](https://pub.dev/packages/apple_vision_image_depth) | ||
[![analysis](https://github.com/Knightro63/apple_vision/actions/workflows/flutter.yml/badge.svg)](https://github.com/Knightro63/apple_vision/actions/) | ||
[![Star on Github](https://img.shields.io/github/stars/Knightro63/apple_vision.svg?style=flat&logo=github&colorB=deeppink&label=stars)](https://github.com/Knightro63/apple_vision) | ||
[![License: MIT](https://img.shields.io/badge/license-MIT-purple.svg)](https://opensource.org/licenses/MIT) | ||
|
||
Apple Vision Depth Detection is a Flutter plugin that enables Flutter apps to use [Apple Vision Image Depth](https://developer.apple.com/documentation/avfoundation/additional_data_capture/capturing_photos_with_depth). | ||
|
||
- This plugin is not sponsor or maintained by Apple. The [authors](https://github.com/Knightro63/apple_vision/blob/main/AUTHORS) are developers who wanted to make a similar plugin to Google's ml kit for macos. | ||
|
||
## Requirements | ||
|
||
**MacOS** | ||
- Minimum osx Deployment Target: 10.13 | ||
- Xcode 13 or newer | ||
- Swift 5 | ||
- ML Kit only supports 64-bit architectures (x86_64 and arm64). | ||
|
||
**iOS** | ||
- Minimum ios Deployment Target: 14.0 | ||
- Xcode 13 or newer | ||
- Swift 5 | ||
- ML Kit only supports 64-bit architectures (x86_64 and arm64). | ||
|
||
## Getting Started | ||
|
||
You need to first import 'package:apple_vision/apple_vision.dart'; | ||
|
||
```dart | ||
final GlobalKey cameraKey = GlobalKey(debugLabel: "cameraKey"); | ||
AppleVisionImageClassificationController visionController = AppleVisionImageClassificationController(); | ||
InsertCamera camera = InsertCamera(); | ||
Size imageSize = const Size(640,640*9/16); | ||
String? deviceId; | ||
bool loading = true; | ||
List<Label>? labels; | ||
late double deviceWidth; | ||
late double deviceHeight; | ||
@override | ||
void initState() { | ||
camera.setupCameras().then((value){ | ||
setState(() { | ||
loading = false; | ||
}); | ||
camera.startLiveFeed((InputImage i){ | ||
if(i.metadata?.size != null){ | ||
imageSize = i.metadata!.size; | ||
} | ||
if(mounted) { | ||
Uint8List? image = i.bytes; | ||
visionController.processImage(image!, imageSize).then((data){ | ||
labels = data; | ||
setState(() { | ||
}); | ||
}); | ||
} | ||
}); | ||
}); | ||
super.initState(); | ||
} | ||
@override | ||
void dispose() { | ||
camera.dispose(); | ||
super.dispose(); | ||
} | ||
@override | ||
Widget build(BuildContext context) { | ||
deviceWidth = MediaQuery.of(context).size.width; | ||
deviceHeight = MediaQuery.of(context).size.height; | ||
return Stack( | ||
children:<Widget>[ | ||
SizedBox( | ||
width: imageSize.width, | ||
height: imageSize.height, | ||
child: loading?Container():CameraSetup(camera: camera, size: imageSize) | ||
), | ||
Column(children: showLabel(),) | ||
] | ||
); | ||
} | ||
List<Widget> showLabel(){ | ||
if(labels == null || labels!.isEmpty) return []; | ||
List<Widget> widgets = []; | ||
for(int i = 0; i < labels!.length; i++){ | ||
widgets.add( | ||
Container( | ||
width: 320, | ||
height: 20, | ||
decoration: BoxDecoration( | ||
color: Colors.green, | ||
borderRadius: BorderRadius.circular(5) | ||
), | ||
child: Text( | ||
'${labels![i].label}: ${labels![i].confidence}', | ||
style: const TextStyle( | ||
color: Colors.white, | ||
fontSize: 12 | ||
), | ||
), | ||
) | ||
); | ||
} | ||
return widgets; | ||
} | ||
Widget loadingWidget(){ | ||
return Container( | ||
width: deviceWidth, | ||
height:deviceHeight, | ||
color: Theme.of(context).canvasColor, | ||
alignment: Alignment.center, | ||
child: const CircularProgressIndicator(color: Colors.blue) | ||
); | ||
} | ||
``` | ||
|
||
## Example | ||
|
||
Find the example for this API [here](https://github.com/Knightro63/apple_vision/tree/main/packages/apple_vision_image_depth/example/lib/main.dart). | ||
|
||
## Contributing | ||
|
||
Contributions are welcome. | ||
In case of any problems look at [existing issues](https://github.com/Knightro63/apple_vision/issues), if you cannot find anything related to your problem then open an issue. | ||
Create an issue before opening a [pull request](https://github.com/Knightro63/apple_vision/pulls) for non trivial fixes. | ||
In case of trivial fixes open a [pull request](https://github.com/Knightro63/apple_vision/pulls) directly. |
Oops, something went wrong.