@drivekyte/react-native-image-validators
v1.0.2
Published
React native image validator library
Downloads
1
Readme
@drivekyte/react-native-image-validators
Image validators
Installation
yarn add @drivekyte/react-native-image-validators
You should add the dependencies below:
yarn add react-native-vision-camera
Follow the react-native-vision-camera
installation guide
Run pod install in your root folder.
npx pod-install
OpenCV installation (Android)
Download the latest version of the OpenCV from their website.
Unzip it in a folder and open the build.gradle
file inside the unzipped folder. Follow the instructions to add it to your main app project using Android Studio.
Usage
Calculate blurry
import { calculateBlurry } from "@drivekyte/react-native-image-validators";
import { useFrameProcessor } from "react-native-vision-camera";
// ...
const frameProcessor = useFrameProcessor((frame) => {
"worklet";
const variation = calculateBlurry(frame);
}, []);
Calculate brightness
import { calculateBrightness } from "@drivekyte/react-native-image-validators";
import { useFrameProcessor } from "react-native-vision-camera";
// ...
const frameProcessor = useFrameProcessor((frame) => {
"worklet";
const variation = calculateBrightness(frame);
}, []);
Calculate all variations
import { calculateVariations } from "@drivekyte/react-native-image-validators";
import { useFrameProcessor } from "react-native-vision-camera";
// ...
const frameProcessor = useFrameProcessor((frame) => {
"worklet";
const { brightness, blurry } = calculateVariations(frame);
}, []);
Modify your babel.config.js
Add the react-native-reanimated
globals to your babel.config.js
module.exports = function (api) {
api.cache(true);
return {
//...
plugins: [
[
"react-native-reanimated/plugin",
{
globals: [
"__scanCodes",
"__getBlurryVariation",
"__getBrightnessVariation",
"__getVariations",
],
},
],
],
};
};
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT
Made with create-react-native-library