All Projects → RobertSasak → React Native Openalpr

RobertSasak / React Native Openalpr

Licence: mit
An open-source React Native automatic license plate recognition package for OpenALPR

Projects that are alternatives of or similar to React Native Openalpr

Rpindvi
Raspberry PI NDVI Code
Stars: ✭ 57 (-86.27%)
Mutual labels:  camera, opencv
Sltk
An OpenCV-based structured light processing toolkit.
Stars: ✭ 151 (-63.61%)
Mutual labels:  camera, opencv
Sitting Posture Recognition
Detects the sitting position of a person
Stars: ✭ 64 (-84.58%)
Mutual labels:  camera, opencv
Camodet
Lightweight Simple CAmera MOtion DETection application.
Stars: ✭ 26 (-93.73%)
Mutual labels:  camera, opencv
Live Video Magnification
An OpenCV/Qt based realtime application for Eulerian Video Magnification / Motion Magnification. Works with multiple videos and cameras at the same time and let's you export the magnified videos.
Stars: ✭ 187 (-54.94%)
Mutual labels:  camera, opencv
Camera calibration api
A simple Python API for single camera calibration using opencv
Stars: ✭ 36 (-91.33%)
Mutual labels:  camera, opencv
Androidfacedetection
Android 平台进行人脸检测的几种方案
Stars: ✭ 106 (-74.46%)
Mutual labels:  camera, opencv
Scanner
二维码/条码识别、身份证识别、银行卡识别、车牌识别、图片文字识别、黄图识别、驾驶证(驾照)识别
Stars: ✭ 547 (+31.81%)
Mutual labels:  camera, opencv
Neuvision
Structured Light based 3D scanner
Stars: ✭ 165 (-60.24%)
Mutual labels:  camera, opencv
Stereo Vision
This program has been developed as part of a project at the University of Karlsruhe in Germany. The final purpose of the algorithm is to measure the distance to an object by combining two webcams and use them as a Stereo Camera.
Stars: ✭ 160 (-61.45%)
Mutual labels:  camera, opencv
Multi Threading Camera Stream
Multi-threading camera stream to improve video processing performance
Stars: ✭ 18 (-95.66%)
Mutual labels:  camera, opencv
React Native Opencv Tutorial
👩‍🏫Fully working example of the OpenCV library used together with React Native
Stars: ✭ 244 (-41.2%)
Mutual labels:  camera, opencv
Computer Vision
Computer vision exercise with Python and OpenCV.
Stars: ✭ 17 (-95.9%)
Mutual labels:  camera, opencv
Keera Posture
Alleviate your back pain using Haskell and a webcam
Stars: ✭ 48 (-88.43%)
Mutual labels:  camera, opencv
V4l2loopback cpp
v4l2loopback usage in C++ and from OpenCV
Stars: ✭ 6 (-98.55%)
Mutual labels:  camera, opencv
Phormatics
Using A.I. and computer vision to build a virtual personal fitness trainer. (Most Startup-Viable Hack - HackNYU2018)
Stars: ✭ 79 (-80.96%)
Mutual labels:  camera, opencv
Smartopencv
🔥 🔥 🔥 SmartOpenCV是一个OpenCV在Android端的增强库,解决了OpenCV Android SDK在图像预览方面存在的诸多问题,且无需修改OpenCV SDK源码,与OpenCV的SDK解耦
Stars: ✭ 1,869 (+350.36%)
Mutual labels:  camera, opencv
Primestereomatch
A heterogeneous and fully parallel stereo matching algorithm for depth estimation, implementing a local adaptive support weight (ADSW) Guided Image Filter (GIF) cost aggregation stage. Developed in both C++ and OpenCL.
Stars: ✭ 191 (-53.98%)
Mutual labels:  camera, opencv
Grip
Program for rapidly developing computer vision applications
Stars: ✭ 314 (-24.34%)
Mutual labels:  camera, opencv
Nowatermark
remove watermark. 去除图片中的水印
Stars: ✭ 373 (-10.12%)
Mutual labels:  opencv

Build Status Gitter

react-native-openalpr

OpenALPR integration for React Native. Provides a camera component that recognizes license plates in real-time. Supports both iOS and Android.

OpenALPR iOS Demo Video OpenALPR Android Demo Video

Requirements

  • iOS 9+
  • Android 5.0+
  • RN 0.60+

Installation

Installation with React Native

Start by adding the package and linking it.

$ yarn add react-native-openalpr

iOS Specific Setup

Install pods

$ cd ios && pod install && cd ..

Camera Permissions

  • Add an entry for NSCameraUsageDescription in your info.plist explaining why your app will use the camera. If you forget to add this, your app will crash!
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
  ...
 	<key>NSCameraUsageDescription</key>
 	<string>We use your camera for license plate recognition to make it easier for you to add your vehicle.</string>
</dict>

Bitcode

Because the OpenCV binary framework release is compiled without bitcode, the other frameworks built by this script are also built without it, which ultimately means your Xcode project also cannot be built with bitcode enabled. Per this message, it sounds like we want this feature disabled for OpenCV anyway.

To disable bitcode in your project:

  • In Build SettingsBuild Options, search for Enable Bitcode and set it to No.

Android-specific Setup

Camera Permissions

  • Add permissions for CAMERA and FLASHLIGHT and the related features (below) to AndroidManifest.xml. If you forget to add these permissions, your app will crash!
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  <!-- Camera Permissions -->
  <uses-permission android:name="android.permission.CAMERA" />

  <uses-feature
      android:name="android.hardware.camera"
      android:required="false" />
  <uses-feature
      android:name="android.hardware.camera.autofocus"
      android:required="false" />

  <uses-permission android:name="android.permission.FLASHLIGHT" />

Add to Gradle

Your android/settings.gradle file should have following lines:
rootProject.name = 'RNOpenALPRExample'
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
include ':app'

// Add these lines
include ':openalpr'
project(':openalpr').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-openalpr/android/libraries/openalpr')
include ':opencv'
project(':opencv').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-openalpr/android/libraries/opencv')

Linking

The library is linked automatically with leptonica, opencv, tesseract, and openalpr (openalpr). To make it work, copy and paste the directory with the runtime needed data to your project at path android/app/src/main/assets/runtime_data.

The runtime_data file can be found in /example/android/app/src/main/assets/ in this repo. Open runtime_data/openalpr.conf file and replace com.rnopenalprexample with your package name

[common]

; Specify the path to the runtime data directory
runtime_dir = /data/data/com.rnopenalprexample/runtime_data


ocr_img_size_percent = 1.33333333
state_id_img_size_percent = 2.0
...

Usage

OpenALPR exposes a camera component (based on react-native-camera) that is optimized to run OpenALPR image processing on a live camera stream. Among other parameters, the camera accepts a callback, onPlateRecognized, for when a plate is recognized.

import React, { Component } from 'react'
import { StyleSheet, Text, View } from 'react-native'

import Camera, {
  Aspect,
  CaptureQuality,
  TorchMode,
} from 'react-native-openalpr'

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  textContainer: {
    position: 'absolute',
    top: 100,
    left: 50,
  },
  text: {
    textAlign: 'center',
    fontSize: 20,
  },
})

export default class PlateRecognizer extends React.Component {
  state = {
    plate: 'Scan a plate',
  }

  onPlateRecognized = ({ plate, confidence }) => {
    this.setState({
      plate,
    })
  }

  render() {
    return (
      <View style={styles.container}>
        <Camera
          style={styles.preview}
          aspect={Aspect.fill}
          captureQuality={CaptureQuality.medium}
          country="us"
          onPlateRecognized={this.onPlateRecognized}
          plateOutlineColor="#ff0000"
          showPlateOutline
          zoom={0}
          torchMode={TorchMode.off}
          touchToFocus
        />
        <View style={styles.textContainer}>
          <Text style={styles.text}>{this.state.plate}</Text>
        </View>
      </View>
    )
  }
}

Options

zoom

The zoon of the camera (Android only). Can be :

0 to 99

aspect

The aspect ratio of the camera. Can be one of:

  • Aspect.stretch
  • Aspect.fit
  • Aspect.fill

captureQuality

The resolution at which video frames are captured and analyzed. For completeness, several options are provided. However, it is strongly recommended that you stick with one of the following for the best frame rates and accuracy:

  • CaptureQuality.medium (480x360)
  • CaptureQuality.480p (640x480)

country

Specifies which OpenALPR config file to load, corresponding to the country whose plates you wish to recognize. Currently supported values are:

  • au
  • br
  • eu
  • fr
  • gb
  • kr
  • mx
  • sg
  • us
  • vn2

onPlateRecognized

This callback receives a hash with keys:

  • plate, representing the recognized license plate string
  • confidence, OpenALPR's confidence(%) in the result

plateOutlineColor

Hex string specifying the color of the border to draw around the recognized plate. Example: #ff0000 for red.

showPlateOutline

If true, this draws an outline over the recognized plate

torchMode

Turns the flashlight on or off. Can be one of:

  • TorchMode.on
  • TorchMode.off
  • TorchMode.auto

touchToFocus

If true, this focuses the camera where the user taps

Examples

Development

  • This project works with iOS and Android. It may have some bugs depending on how the underlying native components are updated

Running the Example project on Android While Developing

  1. Clone the repo and enter the example directory
git clone https://github.com/RobertSasak/react-native-openalpr.git
cd react-native-openalpr
cd example
  1. From the example directory, run yarn

  2. Copy the android folder from /react-native-openalpr/android to /react-native-openalpr/example/node_modules/react-native-openalpr/

  3. Open Android Studio and import the project react-native-openalpr/example/android and wait until Android Studio indexes and links.

  4. Run npm start from dir /react-native-openalpr/example/

  5. Open the path in your browser http://localhost:8081/index.android.bundle?platform=android&dev=true&hot=false&minify=false

  6. Create file the /react-native-openalpr/example/android/app/src/main/assets/index.android.bundle. Copy and paste the data from browser window to the file you just created and save.

  7. Return to Android Studio and run project on your development device.

Note: If you are getting errors, double check that you have completed all of the steps above. If you are having issues running npm start on Mac OSX and are using homebrew, this issue might help.

Credits

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].