GithubHelp home page GithubHelp logo

rbayuokt / react-native-image-detective Goto Github PK

View Code? Open in Web Editor NEW
14.0 1.0 0.0 8.09 MB

React Native library to simplify the integration of AI and ML features into your mobile app.

License: MIT License

Java 42.98% JavaScript 3.69% Ruby 5.45% Swift 0.08% C 0.13% Objective-C 3.11% Objective-C++ 23.33% TypeScript 21.24%
mlkit mlkit-barcode mlkit-face-detection mlkit-imagelabeling mlkit-pose-detection mlkit-text-recognition react-native

react-native-image-detective's Introduction

react-native-image-detective

cover

โœจ ALL IN ONE, ALL IN JUST ONE LINE โœจ

late-night brain sessions often lead to interesting questions. lately, I've been pondering:
"can React Native and the wild world of AI/ML join forces and create some magic? yes, they totally can!" ๐Ÿ˜Ž

not one to let dreams stay as dreams, I dived into research mode. the burning question led me to a fascinating project where React Native and AI/ML got cozy.

why all this fuss? well, I'm on a mission to shake things up in the React Native community. forget pointing fingers, let's make it better together. this journey might be a baby step, but hey, even small steps can leave giant footprints.

powered by Google's MLKit, I whipped up native modules for Android (using Java), iOS (using Objective C) and TypeScript ๐Ÿš€โœจ

Features

well, I'm striving to make this library easy to integrate and user-friendly with minimal effort, so let's get started!

  1. Face Detection
  2. Barcode Scanner
  3. Image Labeler
  4. Coming Soon ! ๐Ÿš€

Installation

npm install react-native-image-detective
or
yarn add react-native-image-detective

npx pod-install

Usage

select a picture from either your camera or device using another library of your choice. in this example folder
I've used react-native-image-picker

  1. Face Detection

    face-detection-demo
import ImageDetective from 'react-native-image-detective';

// ... blablababla

const onImageChanges = async (res: ImagePickerResponse) => {
    try {
      if (!res.assets || !res.assets[0]?.uri) {
        return;
      }

      const imagePath = res.assets[0].uri;
      // MAIN CODE
      const image = await ImageDetective.analyzeFace(imagePath);
      // END OF MAIN CODE

      console.log('[Image response] :', image.faces);

      if (image.isValid) {
        Alert.alert(
          'Face detected',
          'Hoorayy !!'
        );
      } else {
        Alert.alert(
          'Face not detected',
          'Please reupload an image with your face in it.'
        );
      }
    } catch (error) {
      console.log('error', error);
    }
  };
  1. Barcode Scanner

    barcode-scanner-demo
    supports the following formats:
    Code-128, 39, 93, Codabar, Data Matrix, EAN-13, EAN-8, ITF, QR Code, UPC-A, UPC-E, PDF-417, and Aztec Code.
import ImageDetective from 'react-native-image-detective';

// ... blablababla

  const onBarcodeScan = async (res: ImagePickerResponse) => {
    try {
      if (!res.assets || !res.assets[0]?.uri) {
        return;
      }

      const imagePath = res.assets[0].uri;
      // MAIN CODE
      const barcode = await ImageDetective.analyzeBarcode(imagePath);
      // END OF MAIN CODE
      console.log('[barcode response] :', JSON.stringify(barcode));

      if (barcode.isValid) {
        Alert.alert('barcode result', JSON.stringify(barcode));
      } else {
        Alert.alert('Barcode not detected', 'Please reupload a barcode in it.');
      }
    } catch (error) {
      console.log('error', error);
    }
  };
  1. Image Labeler

    image-labeler-demo
import ImageDetective from 'react-native-image-detective';

const onImageLabeler = async (res: ImagePickerResponse) => {
    try {
      if (!res.assets || !res.assets[0]?.uri) {
        return;
      }

      const imagePath = res.assets[0].uri;
      // MAIN CODE
      const imageLabeler = await ImageDetective.analyzeImage(imagePath);
      // END OF MAIN CODE
      
      if (imageLabeler.isValid) {
        console.log('[image labeler response] :', JSON.stringify(imageLabeler));
      } else {
        Alert.alert('Oopss!', 'error !');
      }
    } catch (error) {
      console.log('error', error);
    }
  };
  1. coming soon ! ๐Ÿš€

Contributing

Please help me make this library both fun and useful to use. Share your ideas about what AI/ML features could be on the list for the next version!

License

MIT


Made with โค๏ธ by @rbayuokt, thanks to create-react-native-library

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.