@drivekyte/react-native-image-validators
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

@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

Package Sidebar

Install

npm i @drivekyte/react-native-image-validators

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

36.1 kB

Total Files

28

Last publish

Collaborators

  • npmerson
  • gvirtuoso
  • filipe-kyte
  • joaolucas.drivekyte
  • infrakyte
  • conrado.drivekyte