Skip to content

Commit

Permalink
Merge branch 'Knightro63:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
alihassan143 committed Jan 26, 2024
2 parents 381522d + e9c518e commit 1bd9a75
Show file tree
Hide file tree
Showing 186 changed files with 9,175 additions and 17 deletions.
Binary file modified packages/.DS_Store
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/apple_vision/example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
platform :osx, '12.0'
platform :osx, '14.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MACOSX_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
Expand All @@ -426,7 +426,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = 14.0;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
};
Expand Down Expand Up @@ -484,7 +484,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MACOSX_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
Expand Down Expand Up @@ -531,7 +531,7 @@
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
MACOSX_DEPLOYMENT_TARGET = 10.14;
MACOSX_DEPLOYMENT_TARGET = 14.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = macosx;
SWIFT_COMPILATION_MODE = wholemodule;
Expand All @@ -553,7 +553,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = 14.0;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
Expand All @@ -574,7 +574,7 @@
"$(inherited)",
"@executable_path/../Frameworks",
);
MACOSX_DEPLOYMENT_TARGET = 12.0;
MACOSX_DEPLOYMENT_TARGET = 14.0;
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_VERSION = 5.0;
};
Expand Down
4 changes: 2 additions & 2 deletions packages/apple_vision/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ dependencies:
sdk: flutter

apple_vision_animal_pose: ^0.0.2
apple_vision_pose_3d: ^0.0.1
apple_vision_commons: ^0.0.2
apple_vision_face: ^0.0.3
apple_vision_face_detection: ^0.0.2
Expand All @@ -21,9 +20,10 @@ dependencies:
apple_vision_object: ^0.0.2
apple_vision_object_tracking: ^0.0.2
apple_vision_pose: ^0.0.3
apple_vision_pose_3d: ^0.0.1
apple_vision_recognize_text: ^0.0.2
apple_vision_selfie: ^0.0.2
apple_vision_scanner: ^0.0.2
apple_vision_selfie: ^0.0.2

dev_dependencies:
flutter_test:
Expand Down
2 changes: 1 addition & 1 deletion packages/apple_vision_image_classification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![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 Selfie Detection is a Flutter plugin that enables Flutter apps to use [Apple Vision Image Classification](https://developer.apple.com/documentation/vision/classifying_images_with_vision_and_core_ml).
Apple Vision Image Classification is a Flutter plugin that enables Flutter apps to use [Apple Vision Image Classification](https://developer.apple.com/documentation/vision/classifying_images_with_vision_and_core_ml).

- 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.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public class AppleVisionImageClassificationPlugin: NSObject, FlutterPlugin {
}
func processObservation(_ observation: VNClassificationObservation,_ imageSize: CGSize) -> [String:Any?]? {

if observation.confidence > 0.75{
if observation.confidence > 0.0{
return [
"label":observation.identifier,
"confidence": observation.confidence
Expand Down
2 changes: 1 addition & 1 deletion packages/apple_vision_image_classification/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: apple_vision_image_classification
description: A Flutter plugin to use Apple Vision Image Classification the classifies an image.
description: A Flutter plugin to use Apple Vision Image Classification to classifies an image.
version: 0.0.2
homepage: https://github.com/Knightro63/apple_vision/tree/main/packages/apple_vision_image_classification

Expand Down
132 changes: 132 additions & 0 deletions packages/apple_vision_image_depth/.gitignore
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
3 changes: 3 additions & 0 deletions packages/apple_vision_image_depth/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* Initial release
21 changes: 21 additions & 0 deletions packages/apple_vision_image_depth/LICENSE
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.
133 changes: 133 additions & 0 deletions packages/apple_vision_image_depth/README.md
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.
Loading

0 comments on commit 1bd9a75

Please sign in to comment.