Giter Site home page Giter Site logo

andreluisjunqueira / react-native-document-scanner-android Goto Github PK

View Code? Open in Web Editor NEW
81.0 81.0 32.0 63.08 MB

Document scanner android, feature live detection, auto-capture, perspective correction :vibration_mode: :camera: -- :trophy:

License: MIT License

JavaScript 1.44% Java 90.28% Makefile 0.43% TypeScript 2.51% C 0.10% Objective-C 3.99% Swift 0.07% Ruby 1.17%

react-native-document-scanner-android's Introduction

Ola! eu sou o André 👋

Sou formado em Ciência da computação e já desenvolvo software a cerca de 10 anos. Já desenvolvi em várias linguagens de programação, porém hoje estou mais focado em desenvolvimento mobile.
Sou apaixonado por tecnologia e programação !

Linkedin

André's GitHub stats-Dark

Essas são as tecnologias que tenho conhecimento ⬇️

Principais
Javascript Typescript React native React Redux Jest

Secundárias
Html 5 Css3 Ruby Swift Elixir Flutter


react-native-document-scanner-android's People

Contributors

andreluisjunqueira avatar erickmaeda avatar guihendias avatar thongdn avatar weslleynasrocha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-native-document-scanner-android's Issues

i have this issue

Configure project :react-native-documentscanner-android
WARNING: Configuration 'compile' is obsolete and has been replaced with 'implementation' and 'api'.
It will be removed at the end of 2018. For more information see: http://d.android.com/r/tools/update-dependency-configurations.html
WARNING: The specified Android SDK Build Tools version (23.0.1) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.3.1.
Android SDK Build Tools 28.0.3 will be used.
To suppress this warning, remove "buildToolsVersion '23.0.1'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools.

Aspect ratio

Would be nice to have a prop where you could set an aspect ratio for the camera preview. getMaxPreviewResolution function (OpenNoteCameraView.java) as for now returns the supported resolution with maximum width and for example on my device that means resolving to a resolution of 2560x800. That's pretty awkward to work with. :) Resulting aspect ratio is then used for finding the corresponding image size and that's also problematic in this case. Seems to work decently when modified to get max preview resolution by width * height.

Component never drawn

Hi,
I imported your library into my project and somehow, I couldn't manage to get it work. I followed the steps described in the README and yet, no luck. I had to update support library version and compileSdkVersion to match those of my project.
So far, I can implement your component but it doesn't display anything.
Any thoughts ?

Unable to detect the image corners

I have integrated the library in my project, it's opening the camera but i need to give permission for camera and local storage manually to app. and it's also not detecting the document's corners and giving the exact image clicked as result.

Capture detection and scanning not working

I am using react-native-documentscanner-android. I have done all steps and camera is opening with write storage permission but scanning is not working. Please help, I got stuck from last two days.
<DocumentScanner onPictureTaken={data =>{ console.log(data.path) }} onProcessing={() => alert(11)} enableTorch={false} detectionCountBeforeCapture={10} style={styles.scanner} />

I have clonned your repo and facing some issues after doing npm i and local.properties to the folder of android.

  • What went wrong:
    Execution failed for task ':generateDebugRFile'.

Could not resolve all files for configuration ':debugRuntimeClasspath'.
Could not resolve com.github.ctodobom:OpenCV-3.1.0-Android:-SNAPSHOT.
Required by:
project :
> Could not resolve com.github.ctodobom:OpenCV-3.1.0-Android:-SNAPSHOT.
> Unable to load Maven meta-data from https://jitpack.io/com/github/ctodobom/OpenCV-3.1.0-Android/-SNAPSHOT/maven-metadata.xml.
> Could not get resource 'https://jitpack.io/com/github/ctodobom/OpenCV-3.1.0-Android/-SNAPSHOT/maven-metadata.xml'.
> Could not GET 'https://jitpack.io/com/github/ctodobom/OpenCV-3.1.0-Android/-SNAPSHOT/maven-metadata.xml'.
> jitpack.io

error: package org.opencv.core does not exist

When I run my app it shows this error in android studio:error: package org.opencv.core does not exist
This is my configuration:

System:
OS: macOS 10.15
CPU: (4) x64 Intel(R) Core(TM) i5-5350U CPU @ 1.80GHz
Memory: 108.92 MB / 8.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 10.2.1 - /usr/local/bin/node
Yarn: 1.16.0 - ~/.yarn/bin/yarn
npm: 6.11.3 - /usr/local/bin/npm
IDEs:
Android Studio: 3.5 AI-191.8026.42.35.5791312
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
react: 16.8.6 => 16.8.6
react-native: 0.60.5 => 0.60.5
npmGlobalPackages:
react-native-cli: 2.0.1

Fix for manual capture method

Background

When trying to use capture method I get crash with error method saying capture method is not available in native module.
Also documentation is not clear how to use it.

I will open PR to fix it.

P.S. Thanks for great module, frame detection works very good!

autofocus failed: app crashes

Fatal Exception: java.lang.RuntimeException: autoFocus failed
at android.hardware.Camera.native_autoFocus(Camera.java)
at android.hardware.Camera.autoFocus + 1382(Camera.java:1382)
at com.documentscanner.views.OpenNoteCameraView.requestManualFocus + 591(OpenNoteCameraView.java:591)
at com.documentscanner.views.OpenNoteCameraView.focus + 188(OpenNoteCameraView.java:188)
at com.documentscanner.views.MainView.focus + 116(MainView.java:116)
at com.documentscanner.views.MainView.onTouchEvent + 56(MainView.java:56)
at android.view.View.dispatchTouchEvent + 13471(View.java:13471)
at android.view.ViewGroup.dispatchTransformedTouchEvent + 3216(ViewGroup.java:3216)
at android.view.ViewGroup.dispatchTouchEvent + 2888(ViewGroup.java:2888)
at android.view.ViewGroup.dispatchTransformedTouchEvent + 3222(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent + 2904(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent + 3222(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent + 2904(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent + 3222(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent + 2904(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent + 3222(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent + 2904(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent + 3222(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent + 2904(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent + 3222(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent + 2904(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent + 3222(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent + 2904(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent + 3222(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent + 2904(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent + 3222(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent + 2904(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent + 3222(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent + 2904(ViewGroup.java:2904)
at android.view.ViewGroup.dispatchTransformedTouchEvent + 3222(ViewGroup.java:3222)
at android.view.ViewGroup.dispatchTouchEvent + 2904(ViewGroup.java:2904)
at com.android.internal.policy.DecorView.superDispatchTouchEvent + 731(DecorView.java:731)
at com.android.internal.policy.PhoneWindow.superDispatchTouchEvent + 1869(PhoneWindow.java:1869)
at android.app.Activity.dispatchTouchEvent + 3487(Activity.java:3487)
at androidx.appcompat.view.WindowCallbackWrapper.dispatchTouchEvent + 69(WindowCallbackWrapper.java:69)
at com.android.internal.policy.DecorView.dispatchTouchEvent + 689(DecorView.java:689)
at android.view.View.dispatchPointerEvent + 13719(View.java:13719)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent + 6125(ViewRootImpl.java:6125)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess + 5903(ViewRootImpl.java:5903)
at android.view.ViewRootImpl$InputStage.deliver + 5352(ViewRootImpl.java:5352)
at android.view.ViewRootImpl$InputStage.onDeliverToNext + 5405(ViewRootImpl.java:5405)
at android.view.ViewRootImpl$InputStage.forward + 5371(ViewRootImpl.java:5371)
at android.view.ViewRootImpl$AsyncInputStage.forward + 5530(ViewRootImpl.java:5530)
at android.view.ViewRootImpl$InputStage.apply + 5379(ViewRootImpl.java:5379)
at android.view.ViewRootImpl$AsyncInputStage.apply + 5587(ViewRootImpl.java:5587)
at android.view.ViewRootImpl$InputStage.deliver + 5352(ViewRootImpl.java:5352)
at android.view.ViewRootImpl$InputStage.onDeliverToNext + 5405(ViewRootImpl.java:5405)
at android.view.ViewRootImpl$InputStage.forward + 5371(ViewRootImpl.java:5371)
at android.view.ViewRootImpl$InputStage.apply + 5379(ViewRootImpl.java:5379)
at android.view.ViewRootImpl$InputStage.deliver + 5352(ViewRootImpl.java:5352)
at android.view.ViewRootImpl.deliverInputEvent + 8412(ViewRootImpl.java:8412)
at android.view.ViewRootImpl.doProcessInputEvents + 8345(ViewRootImpl.java:8345)
at android.view.ViewRootImpl.enqueueInputEvent + 8298(ViewRootImpl.java:8298)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent + 8527(ViewRootImpl.java:8527)
at android.view.InputEventReceiver.dispatchInputEvent + 198(InputEventReceiver.java:198)
at android.os.MessageQueue.nativePollOnce(MessageQueue.java)
at android.os.MessageQueue.next + 326(MessageQueue.java:326)
at android.os.Looper.loop + 181(Looper.java:181)
at android.app.ActivityThread.main + 7073(ActivityThread.java:7073)
at java.lang.reflect.Method.invoke(Method.java)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run + 493(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main + 975(ZygoteInit.java:975)

Error Task :openCVLibrary310:compileDebugAidl FAILED

I have followed the steps in the readme file. I get this error Task :openCVLibrary310:compileDebugAidl FAILED

I have made sure I have added the below lines:

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

Below is the error I get:

> Task :openCVLibrary310:compileDebugAidl FAILED aidl.exe E 07-15 11:10:02 14892 5864 io_delegate.cpp:50] Failed to GetFullPathName(C:\Users\UserName\MyProject\node_modules\react-native-documentscanner-android\android\openCVLibrary310\build\generated\aidl_source_output_dir\debug\compileDebugAidl\out\org\opencv\engine\OpenCVEngineInterface.java)

Am I missing something?

Black Screen issue

I have build and run the project successfully. But its showing black screen and there is no camera or anything that reflects document scanner. Is this library uncompleted? I have a doubt on it.

App.js code

/**

import React, {Component} from 'react';
import {PermissionsAndroid, Platform, StyleSheet, Text, View} from 'react-native';
import DocumentScanner from 'react-native-documentscanner-android';

import Camera from 'react-native-camera';
const width = '100%';
const height = '100%';

export default class App extends Component {

componentDidMount() {
    async function requestCameraPermission() {
        console.log("requestCameraPermission")
        try {
            const granted = await PermissionsAndroid.request(
                PermissionsAndroid.PERMISSIONS.CAMERA,
                {
                    'title': 'Cool Photo App Camera Permission',
                    'message': 'Cool Photo App needs access to your camera ' +
                    'so you can take awesome pictures.'
                }
            )
            if (granted === PermissionsAndroid.RESULTS.GRANTED) {
                console.log("You can STORE the camera")
            } else {
                console.log("storage permission denied")
            }
        }catch(e){
            console.log(e)
        }
        try {
            const granted = await PermissionsAndroid.request(
                PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
                {
                    'title': 'Cool Photo App Camera Permission',
                    'message': 'Cool Photo App needs access to your camera ' +
                    'so you can take awesome pictures.'
                }
            )
            if (granted === PermissionsAndroid.RESULTS.GRANTED) {
                console.log("You can write storage")
            } else {
                console.log("storage permission denied")
            }
        }catch(e){
            console.log(e)
        }
    }
    requestCameraPermission();
}

render() {
return (

<DocumentScanner
style={{ width: width, height: height, backgroundColor: '#fff' }}
onPictureTaken={data =>{
console.log(data.path)
}}
enableTorch={false}
detectionCountBeforeCapture={5}
/>

);

}
}
const styles = StyleSheet.create({
container: {
flex: 1,
width: '100%',
height: '100%',
backgroundColor: '#fff'
}
});

Manual Crop of the image

Hello,

Is there a support for manual crop of the image (selecting the corners of the documents manually)
if not will it be included in coming updates ?

Thank you

Could not resolve com.facebook.react:react-native:0.19.+.

Please help. I cannot build the app.

Could not determine the dependencies of task ':app:preDebugBuild'.

Could not resolve all task dependencies for configuration ':app:debugRuntimeClasspath'.
Could not resolve com.facebook.react:react-native:0.19.+.
Required by:
project :app > project :react-native-documentscanner-android
> Failed to list versions for com.facebook.react:react-native.
> Unable to load Maven meta-data from https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml.
> Could not HEAD 'https://jcenter.bintray.com/com/facebook/react/react-native/maven-metadata.xml'.
> org.apache.http.client.ClientProtocolException (no error message)

Auto detect not working in my application

My code:

<DocumentScanner style={{ flex: 1, backgroundColor: 'transparent', width: '100%', height: '100%', }}
onPictureTaken={data => {
console.log(data.path);
}}
enableTorch={false}
manualOnly={false}
detectionCountBeforeCapture={5} />

unable to install with rpm

Hi I'm trying to install this package with npm several times but every time it stuck on initial installation ...
I also tried different packages and they are installing fine
please check this ASAP I need it badly

Black screen

I am having black screen problem, I already made several configurations however I did not have any progress. The code below is what I am currently using, could you help me:

import React from 'react'
import { PermissionsAndroid, View } from 'react-native'
import DocumentScanner from 'react-native-documentscanner-android'

export default class ScanDoc extends React.Component {

componentDidMount() {
    async function requestCameraPermission() {
        console.log("requestCameraPermission")
        try {
            const granted = await PermissionsAndroid.request(
                PermissionsAndroid.PERMISSIONS.CAMERA,
                {
                    'title': 'Cool Photo App Camera Permission',
                    'message': 'Cool Photo App needs access to your camera ' +
                    'so you can take awesome pictures.'
                }
            )
            if (granted === PermissionsAndroid.RESULTS.GRANTED) {
                console.log("You can STORE the camera")
            } else {
                console.log("storage permission denied")
            }
        }catch(e){
            console.log(e)
        }
        try {
            const granted = await PermissionsAndroid.request(
                PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE,
                {
                    'title': 'Cool Photo App Camera Permission',
                    'message': 'Cool Photo App needs access to your camera ' +
                    'so you can take awesome pictures.'
                }
            )
            if (granted === PermissionsAndroid.RESULTS.GRANTED) {
                console.log("You can write storage")
            } else {
                console.log("storage permission denied")
            }
        }catch(e){
            console.log(e)
        }
    }
    requestCameraPermission();
}

render(){
    return (
        <View style={{flex: 1}}>
            <DocumentScanner style={{flex: 1, backgroundColor: 'transparent', width: '100%', height: '100%',}}
                onPictureTaken={data => {
                    console.log(data.path);
                }}
                enableTorch={false}
                detectionCountBeforeCapture={5}/>
        </View>
    )
}

}

Expo

Is there any way to use this with expo!
It will be great if there is any!
PS- I am new to expo and react native.

Not Running

I cant seem to get it to work,

ive followed the guide, also had to add the implementation lines in the build gradle before it would build.

finally got it bult and installed, but the canvas shows nothing but white ?

any ideas on how to get the camera preview to actual display something ?
i initially thought i was to do with opencv not init , but when looking at the logcat logs i can see the SUCCESS fro opencv debug line, then nothing after .

any help would be appreciated

Update OpenCV library version

There are couple of years and 8516 commits after release of 3.1.0, we can update OpenCV library to latest version.

Build.Gradle Version

Project status

In my React Native app, I'm using the awesome react-native-document-scanner library to scan documents for iOS and I'm now looking for an Android solution (As react-native-document-scanner is laking of an Android support).

The README.md file of this project shows WORK IN PROGRESS NOT WORKING YET at the very top of the file, but I can't find any other information if nor when this lib will be production ready.

Could you please give a status update of this project ?
Also could you please add a video or screenshot?

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.