All Projects → Michaelvilleneuve → React Native Document Scanner

Michaelvilleneuve / React Native Document Scanner

Licence: mit
Document scanner, features live border detection, perspective correction, image filters and more ! 📲📸

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to React Native Document Scanner

Scanbot Sdk Example Android
Document scanning SDK example apps for the Scanbot SDK for Android.
Stars: ✭ 67 (-89.28%)
Mutual labels:  document, scanner
scanbot-sdk-example-ios
No description or website provided.
Stars: ✭ 17 (-97.28%)
Mutual labels:  scanner, document
Omrchecker
Grade exams fast and accurately using a scanner 🖨 or your phone 🤳.
Stars: ✭ 189 (-69.76%)
Mutual labels:  document, scanner
cordova-plugin-document-scanner
cordova plugin for document scan
Stars: ✭ 77 (-87.68%)
Mutual labels:  scanner, document
CleanSCAN
A simple, smart and efficient document scanner for Android
Stars: ✭ 151 (-75.84%)
Mutual labels:  scanner, document
scanbot-sdk-example-ionic
Scanbot scanner SDK example app for Ionic with Cordova.
Stars: ✭ 24 (-96.16%)
Mutual labels:  scanner, document
Cpp Primer 5th Notes Cn
📚 《C++ Primer中文版(第5版)》笔记
Stars: ✭ 458 (-26.72%)
Mutual labels:  document
Pandoc
Universal markup converter
Stars: ✭ 24,250 (+3780%)
Mutual labels:  document
Exitmap
A fast and modular scanner for Tor exit relays. The canonical repository (including issue tracker) is at https://gitlab.torproject.org/tpo/network-health/exitmap
Stars: ✭ 440 (-29.6%)
Mutual labels:  scanner
Appinfoscanner
一款适用于以HW行动/红队/渗透测试团队为场景的移动端(Android、iOS、WEB、H5、静态网站)信息收集扫描工具,可以帮助渗透测试工程师、攻击队成员、红队成员快速收集到移动端或者静态WEB站点中关键的资产信息并提供基本的信息输出,如:Title、Domain、CDN、指纹信息、状态信息等。
Stars: ✭ 424 (-32.16%)
Mutual labels:  scanner
Magento Malware Scanner
Scanner, signatures and the largest collection of Magento malware
Stars: ✭ 608 (-2.72%)
Mutual labels:  scanner
Opendoor
OWASP WEB Directory Scanner
Stars: ✭ 586 (-6.24%)
Mutual labels:  scanner
A2sv
Auto Scanning to SSL Vulnerability
Stars: ✭ 524 (-16.16%)
Mutual labels:  scanner
Azscanner
自动漏洞扫描器,自动子域名爆破,自动爬取注入,调用sqlmapapi检测注入,端口扫描,目录爆破,子网段服务探测及其端口扫描,常用框架漏洞检测。 Automatic scanner, automatic sub domain blasting, automatic crawl injection, injection, call the sqlmapapi port scan detection, directory service detection and segment blasting, port scanning, vulnerability detection framework commonly used.
Stars: ✭ 468 (-25.12%)
Mutual labels:  scanner
Security Code Scan
Vulnerability Patterns Detector for C# and VB.NET
Stars: ✭ 550 (-12%)
Mutual labels:  scanner
React Native Vision Camera
📸 The Camera library that sees the vision.
Stars: ✭ 443 (-29.12%)
Mutual labels:  scanner
Silver
Mass scan IPs for vulnerable services
Stars: ✭ 588 (-5.92%)
Mutual labels:  scanner
Pureblood
A Penetration Testing Framework created for Hackers / Pentester / Bug Hunter
Stars: ✭ 431 (-31.04%)
Mutual labels:  scanner
Security Tools
Collection of small security tools, mostly in Bash and Python. CTFs, Bug Bounty and other stuff.
Stars: ✭ 509 (-18.56%)
Mutual labels:  scanner
Scanners Box
A powerful hacker toolkit collected more than 10 categories of open source scanners from Github - 安全行业从业者自研开源扫描器合辑
Stars: ✭ 5,590 (+794.4%)
Mutual labels:  scanner

Demo gif

React Native Document Scanner

Live document detection library. Returns either a URI or a base64 encoded string of the captured image, allowing you to easily store it or use it as you wish !

Features :

  • Live detection
  • Perspective correction and crop of the image
  • Live camera filters (brightness, saturation, contrast)
  • Flash
  • Easy to use base64 image

Can be easily plugged with react-native-perspective-image-cropper

Demo crop gif

Both Platform

Use version >=1.4.1 if you are using react-native 0.48+

$ yarn add https://github.com/Michaelvilleneuve/react-native-document-scanner

$ react-native link react-native-document-scanner

Edit the info.plist file in XCode and add the following permission : NSCameraUsageDescription

Remember, this library uses your device camera, you can't run it on a simulator.

Android Only

If you do not have it already in your project, you must link openCV in your settings.gradle file

include ':openCVLibrary310'
project(':openCVLibrary310').projectDir = new File(rootProject.projectDir,'../node_modules/react-native-document-scanner/android/openCVLibrary310')

In android/app/src/main/AndroidManifest.xml

Change manifest header to avoid "Manifest merger error". After you add xmlns:tools="http://schemas.android.com/tools" should look like this:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.<yourAppName>" xmlns:tools="http://schemas.android.com/tools">

Add tools:replace="android:allowBackup" in <application tag. It should look like this:

<application tools:replace="android:allowBackup" android:name=".MainApplication" android:label="@string/app_name" android:icon="@mipmap/ic_launcher" android:allowBackup="false" android:theme="@style/AppTheme">

Add Camera permissions request:

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

Usage

import React, { Component } from "react";
import { View, Image } from "react-native";

import DocumentScanner from "react-native-document-scanner";

class YourComponent extends Component {
  render() {
    return (
      <View>
        <DocumentScanner
          useBase64
          saveInAppDocument={false}
          onPictureTaken={data =>
            this.setState({
              image: data.croppedImage,
              initialImage: data.initialImage,
              rectangleCoordinates: data.rectangleCoordinates
            })
          }
          overlayColor="rgba(255,130,0, 0.7)"
          enableTorch={false}
          brightness={0.3}
          saturation={1}
          contrast={1.1}
          quality={0.5}
          onRectangleDetect={({ stableCounter, lastDetectionType }) =>
            this.setState({ stableCounter, lastDetectionType })
          }
          detectionCountBeforeCapture={5}
          detectionRefreshRateInMS={50}
          onPermissionsDenied={() => console.log("Permissions Denied")}
        />
        <Image
          source={{ uri: `data:image/jpeg;base64,${this.state.image}` }}
          resizeMode="contain"
        />
      </View>
    );
  }
}

Properties

Prop Platform Default Type Description
overlayColor Both none string Color of the detected rectangle : rgba recommended
detectionCountBeforeCapture Both 5 integer Number of correct rectangle to detect before capture
detectionRefreshRateInMS iOS 50 integer Time between two rectangle detection attempt
enableTorch Both false bool Allows to active or deactivate flash during document detection
useFrontCam iOS false bool Allows you to switch between front and back camera
brightness iOS 0 float Increase or decrease camera brightness. Normal as default.
saturation iOS 1 float Increase or decrease camera saturation. Set 0 for black & white
contrast iOS 1 float Increase or decrease camera contrast. Normal as default
quality iOS 0.8 float Image compression. Reduces both image size and quality
useBase64 iOS false bool If base64 representation should be passed instead of image uri's
saveInAppDocument iOS false bool If should save in app document in case of not using base 64
captureMultiple iOS false bool Keeps the scanner on after a successful capture
onPermissionsDenied android null func Function to call when the Android permissions are denied

Manual capture

  • First get component ref
<DocumentScanner ref={ref => (this.scanner = ref)} />
  • Then call :
this.scanner.capture();

Each rectangle detection (iOS only)

Props Params Type Description
onRectangleDetect { stableCounter, lastDetectionType } object See below

The returned object includes the following keys :

  • stableCounter

Number of correctly formated rectangle found (this number triggers capture once it goes above detectionCountBeforeCapture)

  • lastDetectionType

Enum (0, 1 or 2) corresponding to the type of rectangle found

  1. Correctly formated rectangle
  2. Wrong perspective, bad angle
  3. Too far

Returned image

Prop Params Type Description
onPictureTaken data object Returns the captured image in an object { croppedImage: ('URI or BASE64 string'), initialImage: 'URI or BASE64 string', rectangleCoordinates: 'object of coordinates' }

Save in app document

If you want to use saveInAppDocument options, then don't forget to add those raws in .plist :

<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
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].