diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 3662b37..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "typescript.tsdk": "node_modules/typescript/lib" -} \ No newline at end of file diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index 96b64bc..0000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,76 +0,0 @@ -# Contributor Covenant Code of Conduct - -## Our Pledge - -In the interest of fostering an open and welcoming environment, we as -contributors and maintainers pledge to making participation in our project and -our community a harassment-free experience for everyone, regardless of age, body -size, disability, ethnicity, sex characteristics, gender identity and expression, -level of experience, education, socio-economic status, nationality, personal -appearance, race, religion, or sexual identity and orientation. - -## Our Standards - -Examples of behavior that contributes to creating a positive environment -include: - -* Using welcoming and inclusive language -* Being respectful of differing viewpoints and experiences -* Gracefully accepting constructive criticism -* Focusing on what is best for the community -* Showing empathy towards other community members - -Examples of unacceptable behavior by participants include: - -* The use of sexualized language or imagery and unwelcome sexual attention or - advances -* Trolling, insulting/derogatory comments, and personal or political attacks -* Public or private harassment -* Publishing others' private information, such as a physical or electronic - address, without explicit permission -* Other conduct which could reasonably be considered inappropriate in a - professional setting - -## Our Responsibilities - -Project maintainers are responsible for clarifying the standards of acceptable -behavior and are expected to take appropriate and fair corrective action in -response to any instances of unacceptable behavior. - -Project maintainers have the right and responsibility to remove, edit, or -reject comments, commits, code, wiki edits, issues, and other contributions -that are not aligned to this Code of Conduct, or to ban temporarily or -permanently any contributor for other behaviors that they deem inappropriate, -threatening, offensive, or harmful. - -## Scope - -This Code of Conduct applies both within project spaces and in public spaces -when an individual is representing the project or its community. Examples of -representing a project or community include using an official project e-mail -address, posting via an official social media account, or acting as an appointed -representative at an online or offline event. Representation of a project may be -further defined and clarified by project maintainers. - -## Enforcement - -Instances of abusive, harassing, or otherwise unacceptable behavior may be -reported by creating an issue on the GitHub repository. All -complaints will be reviewed and investigated and will result in a response that -is deemed necessary and appropriate to the circumstances. The project team is -obligated to maintain confidentiality with regard to the reporter of an incident. -Further details of specific enforcement policies may be posted separately. - -Project maintainers who do not follow or enforce the Code of Conduct in good -faith may face temporary or permanent repercussions as determined by other -members of the project's leadership. - -## Attribution - -This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, -available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html - -[homepage]: https://www.contributor-covenant.org - -For answers to common questions about this code of conduct, see -https://www.contributor-covenant.org/faq diff --git a/README.md b/README.md index ab213cd..0f8db3f 100644 --- a/README.md +++ b/README.md @@ -6,53 +6,41 @@ -
- -
-
-
📸 The Camera library that sees the vision.
-
npm i react-native-vision-camera
npx pod-install
- - Buy Me a Coffee at ko-fi.com - -
- - - -
- - - -
- -
-
+
-### ‼️‼️‼️‼️‼️ ✨ VisionCamera V3 ‼️‼️‼️‼️‼️ +### Features -**See [this discussion](https://github.com/mrousavy/react-native-vision-camera/issues/1376) for the latest upcoming version of VisionCamera** +VisionCamera is a powerful and fast Camera component for React Native. It features: + +* Photo and Video capture +* Customizable devices and multi-cameras ("fish-eye" zoom) +* Customizable resolutions and aspect-ratios (4k/8k images) +* Customizable FPS (30..240 FPS) +* [Frame Processors](https://react-native-vision-camera.com/docs/guides/frame-processors) (JS worklets to run QR-Code scanning, facial recognition, AI object detection, realtime video chats, ...) +* Smooth zooming (Reanimated) +* Fast pause and resume +* HDR & Night modes +* Custom C++/GPU accelerated video pipeline (OpenGL) + +Install VisionCamera from npm: + +```sh +yarn add react-native-vision-camera +cd ios && pod install +``` + +..and get started by [setting up permissions](https://react-native-vision-camera.com/docs/guides)! ### Documentation * [Guides](https://react-native-vision-camera.com/docs/guides) * [API](https://react-native-vision-camera.com/docs/api) * [Example](./example/) - -### Features - -* Photo and Video capture -* Customizable devices and multi-cameras (smoothly zoom out to "fish-eye" camera) -* Customizable FPS -* [Frame Processors](https://react-native-vision-camera.com/docs/guides/frame-processors) (JS worklets to run QR-Code scanning, facial recognition, AI object detection, realtime video chats, ...) -* Smooth zooming (Reanimated) -* Fast pause and resume -* HDR & Night modes - -> See the [example](./example/) app +* [Frame Processor Plugins](https://react-native-vision-camera.com/docs/guides/frame-processor-plugin-list) ### Example @@ -72,6 +60,8 @@ function App() { } ``` +> See the [example](./example/) app + ### Adopting at scale @@ -82,6 +72,9 @@ VisionCamera is provided _as is_, I work on it in my free time. If you're integrating VisionCamera in a production app, consider [funding this project](https://github.com/sponsors/mrousavy) and contact me to receive premium enterprise support, help with issues, prioritize bugfixes, request features, help at integrating VisionCamera and/or Frame Processors, and more. -
+### Socials -#### 🚀 Get started by [setting up permissions](https://react-native-vision-camera.com/docs/guides/)! +* 🐦 [**Follow me on Twitter**](https://twitter.com/mrousavy) for updates +* 📝 [**Check out my blog**](https://mrousavy.com/blog) for examples and experiments +* 💖 [**Sponsor me on GitHub**](https://github.com/sponsors/mrousavy) to support my work +* 🍪 [**Buy me a Ko-Fi**](https://ko-fi.com/mrousavy) to support my work diff --git a/.clang-format b/cpp/.clang-format similarity index 100% rename from .clang-format rename to cpp/.clang-format diff --git a/docs/docs/guides/FRAME_PROCESSORS.mdx b/docs/docs/guides/FRAME_PROCESSORS.mdx index 813466e..9361b49 100644 --- a/docs/docs/guides/FRAME_PROCESSORS.mdx +++ b/docs/docs/guides/FRAME_PROCESSORS.mdx @@ -54,7 +54,7 @@ Frame processors are by far not limited to Hotdog detection, other examples incl Because they are written in JS, Frame Processors are **simple**, **powerful**, **extensible** and **easy to create** while still running at **native performance**. (Frame Processors can run up to **1000 times a second**!) Also, you can use **fast-refresh** to quickly see changes while developing or publish [over-the-air updates](https://github.com/microsoft/react-native-code-push) to tweak the Hotdog detector's sensitivity in live apps without pushing a native update. :::note -Frame Processors require [**react-native-worklets-core**](https://github.com/chrfalch/react-native-worklets-core) 1.0.0 or higher. +Frame Processors require [**react-native-worklets-core**](https://github.com/margelo/react-native-worklets-core) 1.0.0 or higher. ::: ### Interacting with Frame Processors @@ -127,10 +127,10 @@ Since Frame Processors run synchronously with the Camera Pipeline, anything taki ```ts const frameProcessor = useFrameProcessor((frame) => { 'worklet' - console.log('I'm running synchronously at 60 FPS!') + console.log("I'm running synchronously at 60 FPS!") runAsync(() => { 'worklet' - console.log('I'm running asynchronously, possibly at a lower FPS rate!') + console.log("I'm running asynchronously, possibly at a lower FPS rate!") }) }, []) ``` @@ -142,10 +142,10 @@ Some Frame Processor Plugins don't need to run on every Frame, for example a Fra ```ts const frameProcessor = useFrameProcessor((frame) => { 'worklet' - console.log('I'm running synchronously at 60 FPS!') + console.log("I'm running synchronously at 60 FPS!") runAtTargetFps(2, () => { 'worklet' - console.log('I'm running synchronously at 2 FPS!') + console.log("I'm running synchronously at 2 FPS!") }) }, []) ``` @@ -201,7 +201,7 @@ If you are using the [react-hooks ESLint plugin](https://www.npmjs.com/package/e #### Frame Processors -**Frame Processors** are JS functions that will be **workletized** using [react-native-worklets-core](https://github.com/chrfalch/react-native-worklets-core). They are created on a **parallel camera thread** using a separate JavaScript Runtime (_"VisionCamera JS-Runtime"_) and are **invoked synchronously** (using JSI) without ever going over the bridge. In a **Frame Processor** you can write normal JS code, call back to the React-JS Thread (e.g. `setState`), use [Shared Values](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/shared-values/) and call **Frame Processor Plugins**. +**Frame Processors** are JS functions that will be **workletized** using [react-native-worklets-core](https://github.com/margelo/react-native-worklets-core). They are created on a **parallel camera thread** using a separate JavaScript Runtime (_"VisionCamera JS-Runtime"_) and are **invoked synchronously** (using JSI) without ever going over the bridge. In a **Frame Processor** you can write normal JS code, call back to the React-JS Thread (e.g. `setState`), use [Shared Values](https://docs.swmansion.com/react-native-reanimated/docs/fundamentals/shared-values/) and call **Frame Processor Plugins**. > See [**the example Frame Processor**](https://github.com/mrousavy/react-native-vision-camera/blob/cf68a4c6476d085ec48fc424a53a96962e0c33f9/example/src/CameraPage.tsx#L199-L203) diff --git a/docs/docs/guides/SETUP.mdx b/docs/docs/guides/SETUP.mdx index a15da28..cc32b1c 100644 --- a/docs/docs/guides/SETUP.mdx +++ b/docs/docs/guides/SETUP.mdx @@ -42,9 +42,9 @@ expo install react-native-vision-camera -VisionCamera requires **iOS 11 or higher**, and **Android-SDK version 21 or higher**. See [Troubleshooting](/docs/guides/troubleshooting) if you're having installation issues. +VisionCamera requires **iOS 12 or higher**, and **Android-SDK version 26 or higher**. See [Troubleshooting](/docs/guides/troubleshooting) if you're having installation issues. -> **(Optional)** If you want to use [**Frame Processors**](/docs/guides/frame-processors), you need to install [**react-native-worklets-core**](https://github.com/chrfalch/react-native-worklets-core) 1.0.0 or higher. +> **(Optional)** If you want to use [**Frame Processors**](/docs/guides/frame-processors), you need to install [**react-native-worklets-core**](https://github.com/margelo/react-native-worklets-core) 1.0.0 or higher. ## Updating manifests diff --git a/docs/sidebars.js b/docs/sidebars.js index 5e3ab16..90632d1 100644 --- a/docs/sidebars.js +++ b/docs/sidebars.js @@ -15,9 +15,9 @@ module.exports = { 'guides/frame-processors-plugins-ios', 'guides/frame-processors-plugins-android', 'guides/frame-processors-plugins-final', - 'guides/frame-processor-plugin-list' ] }, + 'guides/frame-processor-plugin-list', 'guides/zooming', 'guides/focusing', 'guides/errors', diff --git a/scripts/clang-format.sh b/scripts/clang-format.sh index 9a8c89b..60cc049 100755 --- a/scripts/clang-format.sh +++ b/scripts/clang-format.sh @@ -2,7 +2,7 @@ if which clang-format >/dev/null; then find cpp ios android/src/main/cpp -type f \( -name "*.h" -o -name "*.cpp" -o -name "*.m" -o -name "*.mm" \) -print0 | while read -d $'\0' file; do - clang-format -i "$file" + clang-format -style=file:./cpp/.clang-format -i "$file" done else echo "warning: clang-format not installed, download from https://clang.llvm.org/docs/ClangFormat.html (or run brew install clang-format)"