This is a flutter plugin to detect edges in a live camera, take the picture of detected edges object, crop it, and save.

Overview

edge_detection

A flutter plugin to detect edges of objects, scan paper, detect corners, detect rectangles. It allows cropping of the detected object image and returns the path of the cropped image.

Usage:

iOS

iOS 10.0 or higher is needed to use the plugin. If compiling for any version lower than 10.0 make sure to check the iOS version before using the plugin. Change the minimum platform version to 10 (or higher) in your ios/Podfile file.

Add below permission to the ios/Runner/Info.plist:

  • one with the key Privacy - Camera Usage Description and a usage description.

Or in text format add the key:

<key>NSCameraUsageDescription</key>
<string>Can I use the camera please?</string>

Android

The plugin code is written in kotlin 1.5.31 so the same has to be set to the android project of yours for compilation. Change the kotlin_version to 1.5.31 in your android/build.gradle file.

ext.kotlin_version = '1.5.31'

Change the minimum Android SDK version to 21 (or higher) in your android/app/build.gradle file.

minSdkVersion 21

Add dependency:

Please check the latest version before installation.

dependencies:
  flutter:
    sdk: flutter
  edge_detection: ^1.0.9

Add the following imports to your Dart code:

import 'package:edge_detection/edge_detection.dart';
//Make sure to await the call to detectEdge.
String imagePath = await EdgeDetection.detectEdge;

Demo

Demo

Screenshots

Android

iOS

Using these native implementation
https://github.com/WeTransfer/WeScan

https://github.com/KePeng1019/SmartPaperScan

Comments
  • loading opencv error

    loading opencv error

    I do the similar to the example but it pulls out error:

    I/Choreographer( 3440): Skipped 68 frames!  The application may be doing too much work on its main thread.
    W/art     ( 3440): Before Android 4.1, method android.graphics.PorterDuffColorFilter androidx.vectordrawable.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable
    I/art     ( 3440): Rejecting re-init on previously-failed class java.lang.Class<androidx.core.view.ViewCompat$2>: java.lang.NoClassDefFoundError: Failed resolution of: Landroid/view/View$OnUnhandledKeyEventListener;
    I/art     ( 3440):   at void androidx.core.view.ViewCompat.setBackground(android.view.View, android.graphics.drawable.Drawable) (ViewCompat.java:2559)
    I/art     ( 3440):   at void androidx.appcompat.widget.ActionBarContainer.<init>(android.content.Context, android.util.AttributeSet) (ActionBarContainer.java:62)
    I/art     ( 3440):   at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
    I/art     ( 3440):   at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
    I/art     ( 3440):   at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:645)
    I/art     ( 3440):   at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:787)
    I/art     ( 3440):   at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:727)
    I/art     ( 3440):   at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:858)
    I/art     ( 3440):   at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:821)
    I/art     ( 3440):   at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:518)
    I/art     ( 3440):   at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:426)
    I/art     ( 3440):   at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:377)
    I/art     ( 3440):   at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:607)
    I/art     ( 3440):   at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
    I/art     ( 3440):   at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
    I/art     ( 3440):   at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
    I/art     ( 3440):   at void com.sample.edgedetection.base.BaseActivity.onCreate(android.os.Bundle) (BaseActivity.kt:13)
    I/art     ( 3440):   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6662)
    I/art     ( 3440):   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
    I/art     ( 3440):   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2599)
    I/art     ( 3440):   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2707)
    I/art     ( 3440):   at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
    I/art     ( 3440):   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1460)
    I/art     ( 3440):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
    I/art     ( 3440):   at void android.os.Looper.loop() (Looper.java:154)
    I/art     ( 3440):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6077)
    I/art     ( 3440):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
    I/art     ( 3440):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:866)
    I/art     ( 3440):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:756)
    I/art     ( 3440): Caused by: java.lang.ClassNotFoundException: Didn't find class "android.view.View$OnUnhandledKeyEventListener" on path: DexPathList[[zip file "/data/app/com.tekree.scann-1/base.apk"],nativeLibraryDirectories=[/data/app/com.tekree.scann-1/lib/x86, /data/app/com.tekree.scann-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]
    I/art     ( 3440):   at java.lang.Class dalvik.system.BaseDexClassLoader.findClass(java.lang.String) (BaseDexClassLoader.java:56)
    I/art     ( 3440):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String, boolean) (ClassLoader.java:380)
    I/art     ( 3440):   at java.lang.Class java.lang.ClassLoader.loadClass(java.lang.String) (ClassLoader.java:312)
    I/art     ( 3440):   at void androidx.core.view.ViewCompat.setBackground(android.view.View, android.graphics.drawable.Drawable) (ViewCompat.java:2559)
    I/art     ( 3440):   at void androidx.appcompat.widget.ActionBarContainer.<init>(android.content.Context, android.util.AttributeSet) (ActionBarContainer.java:62)
    I/art     ( 3440):   at java.lang.Object java.lang.reflect.Constructor.newInstance0!(java.lang.Object[]) (Constructor.java:-2)
    I/art     ( 3440):   at java.lang.Object java.lang.reflect.Constructor.newInstance(java.lang.Object[]) (Constructor.java:430)
    I/art     ( 3440):   at android.view.View android.view.LayoutInflater.createView(java.lang.String, java.lang.String, android.util.AttributeSet) (LayoutInflater.java:645)
    I/art     ( 3440):   at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:787)
    I/art     ( 3440):   at android.view.View android.view.LayoutInflater.createViewFromTag(android.view.View, java.lang.String, android.content.Context, android.util.AttributeSet) (LayoutInflater.java:727)
    I/art     ( 3440):   at void android.view.LayoutInflater.rInflate(org.xmlpull.v1.XmlPullParser, android.view.View, android.content.Context, android.util.AttributeSet, boolean) (LayoutInflater.java:858)
    I/art     ( 3440):   at void android.view.LayoutInflater.rInflateChildren(org.xmlpull.v1.XmlPullParser, android.view.View, android.util.AttributeSet, boolean) (LayoutInflater.java:821)
    I/art     ( 3440):   at android.view.View android.view.LayoutInflater.inflate(org.xmlpull.v1.XmlPullParser, android.view.ViewGroup, boolean) (LayoutInflater.java:518)
    I/art     ( 3440):   at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup, boolean) (LayoutInflater.java:426)
    I/art     ( 3440):   at android.view.View android.view.LayoutInflater.inflate(int, android.view.ViewGroup) (LayoutInflater.java:377)
    I/art     ( 3440):   at android.view.ViewGroup androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor() (AppCompatDelegateImpl.java:607)
    I/art     ( 3440):   at void androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor() (AppCompatDelegateImpl.java:518)
    I/art     ( 3440):   at void androidx.appcompat.app.AppCompatDelegateImpl.setContentView(int) (AppCompatDelegateImpl.java:466)
    I/art     ( 3440):   at void androidx.appcompat.app.AppCompatActivity.setContentView(int) (AppCompatActivity.java:140)
    I/art     ( 3440):   at void com.sample.edgedetection.base.BaseActivity.onCreate(android.os.Bundle) (BaseActivity.kt:13)
    I/art     ( 3440):   at void android.app.Activity.performCreate(android.os.Bundle) (Activity.java:6662)
    I/art     ( 3440):   at void android.app.Instrumentation.callActivityOnCreate(android.app.Activity, android.os.Bundle) (Instrumentation.java:1118)
    I/art     ( 3440):   at android.app.Activity android.app.ActivityThread.performLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent) (ActivityThread.java:2599)
    I/art     ( 3440):   at void android.app.ActivityThread.handleLaunchActivity(android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:2707)
    I/art     ( 3440):   at void android.app.ActivityThread.-wrap12(android.app.ActivityThread, android.app.ActivityThread$ActivityClientRecord, android.content.Intent, java.lang.String) (ActivityThread.java:-1)
    I/art     ( 3440):   at void android.app.ActivityThread$H.handleMessage(android.os.Message) (ActivityThread.java:1460)
    I/art     ( 3440):   at void android.os.Handler.dispatchMessage(android.os.Message) (Handler.java:102)
    I/art     ( 3440):   at void android.os.Looper.loop() (Looper.java:154)
    I/art     ( 3440):   at void android.app.ActivityThread.main(java.lang.String[]) (ActivityThread.java:6077)
    I/art     ( 3440):   at java.lang.Object java.lang.reflect.Method.invoke!(java.lang.Object, java.lang.Object[]) (Method.java:-2)
    I/art     ( 3440):   at void com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run() (ZygoteInit.java:866)
    I/art     ( 3440):   at void com.android.internal.os.ZygoteInit.main(java.lang.String[]) (ZygoteInit.java:756)
    I/art     ( 3440): 
    D/OpenCV/StaticHelper( 3440): Trying to get library list
    E/OpenCV/StaticHelper( 3440): OpenCV error: Cannot load info library for OpenCV
    D/OpenCV/StaticHelper( 3440): Library list: ""
    D/OpenCV/StaticHelper( 3440): First attempt to load libs
    D/OpenCV/StaticHelper( 3440): Trying to init OpenCV libs
    D/OpenCV/StaticHelper( 3440): Trying to load library opencv_java3
    D/OpenCV/StaticHelper( 3440): Cannot load library "opencv_java3"
    W/System.err( 3440): java.lang.UnsatisfiedLinkError: dalvik.system.PathClassLoader[DexPathList[[zip file "/data/app/com.tekree.scann-1/base.apk"],nativeLibraryDirectories=[/data/app/com.tekree.scann-1/lib/x86, /data/app/com.tekree.scann-1/base.apk!/lib/x86, /system/lib, /vendor/lib]]] couldn't find "libopencv_java3.so"
    W/System.err( 3440): 	at java.lang.Runtime.loadLibrary0(Runtime.java:972)
    W/System.err( 3440): 	at java.lang.System.loadLibrary(System.java:1530)
    W/System.err( 3440): 	at org.opencv.android.StaticHelper.loadLibrary(StaticHelper.java:64)
    W/System.err( 3440): 	at org.opencv.android.StaticHelper.initOpenCVLibs(StaticHelper.java:95)
    W/System.err( 3440): 	at org.opencv.android.StaticHelper.initOpenCV(StaticHelper.java:39)
    W/System.err( 3440): 	at org.opencv.android.OpenCVLoader.initDebug(OpenCVLoader.java:102)
    W/System.err( 3440): 	at com.sample.edgedetection.scan.ScanActivity.prepare(ScanActivity.kt:36)
    W/System.err( 3440): 	at com.sample.edgedetection.base.BaseActivity.onCreate(BaseActivity.kt:16)
    W/System.err( 3440): 	at android.app.Activity.performCreate(Activity.java:6662)
    W/System.err( 3440): 	at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
    W/System.err( 3440): 	at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
    W/System.err( 3440): 	at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
    W/System.err( 3440): 	at android.app.ActivityThread.-wrap12(ActivityThread.java)
    W/System.err( 3440): 	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
    W/System.err( 3440): 	at android.os.Handler.dispatchMessage(Handler.java:102)
    W/System.err( 3440): 	at android.os.Looper.loop(Looper.java:154)
    W/System.err( 3440): 	at android.app.ActivityThread.main(ActivityThread.java:6077)
    W/System.err( 3440): 	at java.lang.reflect.Method.invoke(Native Method)
    W/System.err( 3440): 	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:866)
    W/System.err( 3440): 	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:756)
    D/OpenCV/StaticHelper( 3440): First attempt to load libs fails
    I/ScanActivity( 3440): loading opencv error, exit
    
    
    opened by heinhoang 17
  • Contrast, Rotation, Dark Theme, Shape Recognition Improvement

    Contrast, Rotation, Dark Theme, Shape Recognition Improvement

    Added contrast with black and white colors, dark theme, image reset for the initial stage, rotate image with 90º angles, save black and white and rotated image, improved image recognition so that no triangle appears all the time.

    opened by tiagosito 7
  • MissingPluginException(No implementation found for method edge_detect on channel edge_detection)

    MissingPluginException(No implementation found for method edge_detect on channel edge_detection)

    Hello we are getting MissingPluginException when we execute below given code

    try { imagePath = await EdgeDetection.detectEdge; } on PlatformException catch (e) { print(e.toString()); } on Exception catch (e) { print(e.toString()); }

    we added entry of edge_detection library into pubspec.yml file as given below

    edge_detection: ^1.0.4 one thing we noticed that when we add this file_picker: ^1.3.8 file_picker library with edge_detection then its throwing above exception. we unable to rectify this issue why its stoped working. so please help me out

    Thanks

    opened by surajprasad57 6
  • Review screen truncation issue

    Review screen truncation issue

    Since moving to Flutter channel stable 2.8.1 and edge detection 1.07(from pre-null safety) there has been an issue with the review screen page (see photo).

    The bottom of the "Review" screen gets cut-off, revealing the bottom navigation bar of the app. This is especially problematic given the bottom nav bar can be interacted with in this state. This occurs when testing on a real device, portrait only, iOS 15.1.1

    Thank you, I would appreciate any help to resolve this issue!

    IMG_9916

    opened by ImaThanusan 5
  • ENOENT file not found error on Android 11 emulator

    ENOENT file not found error on Android 11 emulator

    Hi, when I run the example code on an emulator using Android 11, as soon as the save button is pressed, the app crashes, giving this error log:

    E/CropActivity( 8333): Saved touched! D/AndroidRuntime( 8333): Shutting down VM E/AndroidRuntime( 8333): FATAL EXCEPTION: main E/AndroidRuntime( 8333): Process: com.example.edge_detection_test, PID: 8333 E/AndroidRuntime( 8333): java.lang.RuntimeException: java.lang.reflect.InvocationTargetException E/AndroidRuntime( 8333): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602) E/AndroidRuntime( 8333): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947) E/AndroidRuntime( 8333): Caused by: java.lang.reflect.InvocationTargetException E/AndroidRuntime( 8333): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime( 8333): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592) E/AndroidRuntime( 8333): ... 1 more E/AndroidRuntime( 8333): Caused by: java.io.FileNotFoundException: /storage/emulated/0/smart_scanner/crop_958.jpeg: open failed: ENOENT (No such file or directory) E/AndroidRuntime( 8333): at libcore.io.IoBridge.open(IoBridge.java:492) E/AndroidRuntime( 8333): at java.io.FileOutputStream.(FileOutputStream.java:236) E/AndroidRuntime( 8333): at java.io.FileOutputStream.(FileOutputStream.java:186) E/AndroidRuntime( 8333): at com.sample.edgedetection.crop.CropPresenter.save(CropPresenter.kt:217) E/AndroidRuntime( 8333): at com.sample.edgedetection.crop.CropActivity.onOptionsItemSelected(CropActivity.kt:78) E/AndroidRuntime( 8333): at android.app.Activity.onMenuItemSelected(Activity.java:4269) E/AndroidRuntime( 8333): at androidx.fragment.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:384) E/AndroidRuntime( 8333): at androidx.appcompat.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:196) E/AndroidRuntime( 8333): at androidx.appcompat.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:109) E/AndroidRuntime( 8333): at androidx.appcompat.app.AppCompatDelegateImpl.onMenuItemSelected(AppCompatDelegateImpl.java:888) E/AndroidRuntime( 8333): at androidx.appcompat.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:840) E/AndroidRuntime( 8333): at androidx.appcompat.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:158) E/AndroidRuntime( 8333): at androidx.appcompat.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:991) E/AndroidRuntime( 8333): at androidx.appcompat.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:981) E/AndroidRuntime( 8333): at androidx.appcompat.widget.ActionMenuView.invokeItem(ActionMenuView.java:625) E/AndroidRuntime( 8333): at androidx.appcompat.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:151) E/AndroidRuntime( 8333): at android.view.View.performClick(View.java:7448) E/AndroidRuntime( 8333): at android.view.View.performClickInternal(View.java:7425) E/AndroidRuntime( 8333): at android.view.View.access$3600(View.java:810) E/AndroidRuntime( 8333): at android.view.View$PerformClick.run(View.java:28305) E/AndroidRuntime( 8333): at android.os.Handler.handleCallback(Handler.java:938) E/AndroidRuntime( 8333): at android.os.Handler.dispatchMessage(Handler.java:99) E/AndroidRuntime( 8333): at android.os.Looper.loop(Looper.java:223) E/AndroidRuntime( 8333): at android.app.ActivityThread.main(ActivityThread.java:7656) E/AndroidRuntime( 8333): ... 3 more E/AndroidRuntime( 8333): Caused by: android.system.ErrnoException: open failed: ENOENT (No such file or directory) E/AndroidRuntime( 8333): at libcore.io.Linux.open(Native Method) E/AndroidRuntime( 8333): at libcore.io.ForwardingOs.open(ForwardingOs.java:166) E/AndroidRuntime( 8333): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:254) E/AndroidRuntime( 8333): at libcore.io.ForwardingOs.open(ForwardingOs.java:166) E/AndroidRuntime( 8333): at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7542) E/AndroidRuntime( 8333): at libcore.io.IoBridge.open(IoBridge.java:478) E/AndroidRuntime( 8333): ... 26 more I/Process ( 8333): Sending signal. PID: 8333 SIG: 9

    I've tried including:

    in the AndroidManifest file, but that doesn't work either.

    Does anyone know where the issue lies and how I can fix this? Any help would be much appreciated.

    opened by EdTengHR 5
  • Camera Plugin Issues Fixed

    Camera Plugin Issues Fixed

    • Resolution issue on different phones
    • Crash on Multiple click on camera
    • Auto Focus Disabled for better response.(User will not initiate scan unless document is in focus), avoids unnecessary delay.
    • Shutter Sound
    • Give any feed back if u want to remove any other changes
    opened by vmwsree 5
  • Pick from gallery!

    Pick from gallery!

    Hello, I am trying to implement gallery scan option and I made it for iOS version but I am having hard time for Android. Can anyone help me about this? @BugsBunnyBR @y-okady @RodrigoPorras @sawankumarbundelkhandi Thanks.

    opened by 3rsin3rgul 5
  • File not found exception

    File not found exception

    I Run the example of this repo and i found file not found exception.

    Caused by: java.io.FileNotFoundException: /storage/emulated/0/smart_scanner/crop_1125.jpeg: open failed: EACCES (Permission denied)

    opened by xbadal 5
  • Saving picture fails on Android 10+

    Saving picture fails on Android 10+

    As described in #33, saving a picture on Android results in

    E/AndroidRuntime(21257): FATAL EXCEPTION: main E/AndroidRuntime(21257): Process: com.ome.dietgene.dev, PID: 21257 E/AndroidRuntime(21257): java.lang.RuntimeException: java.lang.reflect.InvocationTargetException E/AndroidRuntime(21257): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:526) E/AndroidRuntime(21257): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:950) E/AndroidRuntime(21257): Caused by: java.lang.reflect.InvocationTargetException E/AndroidRuntime(21257): at java.lang.reflect.Method.invoke(Native Method) E/AndroidRuntime(21257): at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:516) E/AndroidRuntime(21257): ... 1 more E/AndroidRuntime(21257): Caused by: java.io.FileNotFoundException: /storage/emulated/0/smart_scanner/crop_16732.jpeg: open failed: EACCES (Permission denied) E/AndroidRuntime(21257): at libcore.io.IoBridge.open(IoBridge.java:496) E/AndroidRuntime(21257): at java.io.FileOutputStream.(FileOutputStream.java:235) E/AndroidRuntime(21257): at java.io.FileOutputStream.(FileOutputStream.java:186) E/AndroidRuntime(21257): at com.sample.edgedetection.crop.CropPresenter.save(CropPresenter.kt:129) E/AndroidRuntime(21257): at com.sample.edgedetection.crop.CropActivity.onOptionsItemSelected(CropActivity.kt:55) E/AndroidRuntime(21257): at android.app.Activity.onMenuItemSelected(Activity.java:4155) E/AndroidRuntime(21257): at androidx.fragment.app.FragmentActivity.onMenuItemSelected(FragmentActivity.java:384) E/AndroidRuntime(21257): at androidx.appcompat.app.AppCompatActivity.onMenuItemSelected(AppCompatActivity.java:219) E/AndroidRuntime(21257): at androidx.appcompat.view.WindowCallbackWrapper.onMenuItemSelected(WindowCallbackWrapper.java:109) E/AndroidRuntime(21257): at androidx.appcompat.app.AppCompatDelegateImpl.onMenuItemSelected(AppCompatDelegateImpl.java:1030) E/AndroidRuntime(21257): at androidx.appcompat.view.menu.MenuBuilder.dispatchMenuItemSelected(MenuBuilder.java:840) E/AndroidRuntime(21257): at androidx.appcompat.view.menu.MenuItemImpl.invoke(MenuItemImpl.java:158) E/AndroidRuntime(21257): at androidx.appcompat.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:991) E/AndroidRuntime(21257): at androidx.appcompat.view.menu.MenuBuilder.performItemAction(MenuBuilder.java:981) E/AndroidRuntime(21257): at androidx.appcompat.widget.ActionMenuView.invokeItem(ActionMenuView.java:625) E/AndroidRuntime(21257): at androidx.appcompat.view.menu.ActionMenuItemView.onClick(ActionMenuItemView.java:151) E/AndroidRuntime(21257): at android.view.View.performClick(View.java:7201) E/AndroidRuntime(21257): at android.view.View.performClickInternal(View.java:7170) E/AndroidRuntime(21257): at android.view.View.access$3500(View.java:806) E/AndroidRuntime(21257): at android.view.View$PerformClick.run(View.java:27582) E/AndroidRuntime(21257): at android.os.Handler.handleCallback(Handler.java:883) E/AndroidRuntime(21257): at android.os.Handler.dispatchMessage(Handler.java:100) E/AndroidRuntime(21257): at android.os.Looper.loop(Looper.java:214) E/AndroidRuntime(21257): at android.app.ActivityThread.main(ActivityThread.java:7710) E/AndroidRuntime(21257): ... 3 more E/AndroidRuntime(21257): Caused by: android.system.ErrnoException: open failed: EACCES (Permission denied) E/AndroidRuntime(21257): at libcore.io.Linux.open(Native Method) E/AndroidRuntime(21257): at libcore.io.ForwardingOs.open(ForwardingOs.java:167) E/AndroidRuntime(21257): at libcore.io.BlockGuardOs.open(BlockGuardOs.java:252) E/AndroidRuntime(21257): at libcore.io.ForwardingOs.open(ForwardingOs.java:167) E/AndroidRuntime(21257): at android.app.ActivityThread$AndroidOs.open(ActivityThread.java:7609) E/AndroidRuntime(21257): at libcore.io.IoBridge.open(IoBridge.java:482) E/AndroidRuntime(21257): ... 26 more

    because of https://developer.android.com/training/data-storage#scoped-storage.

    Google Play will require app updates to have targetSdk 29+ from 2 November 2020 https://developer.android.com/distribute/best-practices/develop/target-sdk#pre10 , so the plugin will become essentially unusable if the bug is not fixed

    opened by nikolaychernov 4
  • App crashes frequently using edge detection

    App crashes frequently using edge detection

    Fatal Exception: java.lang.RuntimeException takePicture failed

    android.hardware.Camera.native_takePicture (Camera.java) android.hardware.Camera.takePicture (Camera.java:1564) android.hardware.Camera.takePicture (Camera.java:1506) com.sample.edgedetection.scan.ScanPresenter$shut$1.onAutoFocus (ScanPresenter.kt:67) android.hardware.Camera$EventHandler.handleMessage (Camera.java:1238) android.os.Handler.dispatchMessage (Handler.java:107) android.os.Looper.loop (Looper.java:237) android.app.ActivityThread.main (ActivityThread.java:7860) java.lang.reflect.Method.invoke (Method.java) com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:493) com.android.internal.os.ZygoteInit.main (ZygoteInit.java:1075)

    opened by PranayRaj2801 4
  • Attribute application@theme value=(@style/AppTheme)

    Attribute application@theme value=(@style/AppTheme)

    Hello, I have the following problem: When I integrate the plugin I get the error message:

    _Attributes application@theme value=(@style/AppTheme) from [:edge_detection] AndroidManifest.xml:13:9-40
    	is also present at [:flutter_barcode_scanner]_
    

    The solution offered:

    Suggestion: add 'tools:replace="android:theme"' to <application> element at AndroidManifest.xml:16:5-45:19 to override

    doesn't work.

    How can I fix the problem?

    opened by os20 4
  • edge detection sometimes has only 3 points

    edge detection sometimes has only 3 points

    sometimes in Android the scanner gets only 3 points instead of 4 and is not possible to crop a document, user need to start scanning again. also it detects very small objects. is it possible to have a bigger minimun square area?

    opened by anthonycuervo23 1
  • ios select gallery image crop has error

    ios select gallery image crop has error

    When you run the git example file, an error appears when you select a picture in the gallery. Android has not been tested.

    The code in Pub.dev works.

    The following FileSystemException was thrown resolving an image codec:
    Cannot open file, path = '/var/mobile/Containers/Data/Application/10A55998-891A-47DB-B98D-CCA0BAEC312E/Library/Application Support/1668071559.jpeg' (OS Error: No such file or directory, errno = 2)
    
    When the exception was thrown, this was the stack
    #0      _File.open.<anonymous closure> (dart:io/file_impl.dart:356:9)
    <asynchronous suspension>
    #1      FileImage._loadAsync
    package:flutter/…/painting/image_provider.dart:994
    <asynchronous suspension>
    Path: /var/mobile/Containers/Data/Application/10A55998-891A-47DB-B98D-CCA0BAEC312E/Library/Application Support/1668071559.jpeg
    
    opened by giroskii 1
  • Bound width and height of detected rectangle?

    Bound width and height of detected rectangle?

    Is there a way, we could just bound the camera to detect rectangles within the given range of width and height? As of now, it's detecting small rectangles within the same rectangle, which is useless.

    opened by DARK-PROGRAMMER-I 0
  • Runtime App crash when trying to crop the scanned image

    Runtime App crash when trying to crop the scanned image

    ava.lang.RuntimeException: Canvas: trying to draw too large(136666408bytes) bitmap. at android.graphics.RecordingCanvas.throwIfCannotDraw(RecordingCanvas.java:280) at android.graphics.BaseRecordingCanvas.drawBitmap(BaseRecordingCanvas.java:88) at android.graphics.drawable.BitmapDrawable.draw(BitmapDrawable.java:548) at android.widget.ImageView.onDraw(ImageView.java:1434) at android.view.View.draw(View.java:21440) at android.view.View.updateDisplayListIfDirty(View.java:20317) at android.view.View.draw(View.java:21172) at android.view.ViewGroup.drawChild(ViewGroup.java:4388) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4149) at android.view.View.updateDisplayListIfDirty(View.java:20308) at android.view.View.draw(View.java:21172) at android.view.ViewGroup.drawChild(ViewGroup.java:4388) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4149) at android.view.View.updateDisplayListIfDirty(View.java:20308) at android.view.View.draw(View.java:21172) at android.view.ViewGroup.drawChild(ViewGroup.java:4388) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4149) at android.view.View.updateDisplayListIfDirty(View.java:20308) at android.view.View.draw(View.java:21172) at android.view.ViewGroup.drawChild(ViewGroup.java:4388) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4149) at android.view.View.updateDisplayListIfDirty(View.java:20308) at android.view.View.draw(View.java:21172) at android.view.ViewGroup.drawChild(ViewGroup.java:4388) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4149) at android.view.View.updateDisplayListIfDirty(View.java:20308) at android.view.View.draw(View.java:21172) at android.view.ViewGroup.drawChild(ViewGroup.java:4388) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4149) at android.view.View.draw(View.java:21443) at com.android.internal.policy.DecorView.draw(DecorView.java:806) at android.view.View.updateDisplayListIfDirty(View.java:20317) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:575) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:581) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:654) at android.view.ViewRootImpl.draw(ViewRootImpl.java:3608) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3416) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2753) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1719) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7602) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1029) at android.view.Choreographer.doCallbacks(Choreographer.java:852) at android.view.Choreographer.doFrame(Choreographer.java:787) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1014) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7403) at java.lang.reflect.Method.invoke(Method.java:-2) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)

    opened by ManjunathVMK 0
  • File does not exist

    File does not exist

    Hi All,

    i have this lines of code

    EdgeDetection.useInternalStorage(true); String? imagePath = await EdgeDetection.detectEdge;

    that give me to the log "File does not exist"

    someone can help?

    opened by federicolucca 0
Owner
Sawan Kumar Bundelkhandi
Trying not to be a mediocre programmer.
Sawan Kumar Bundelkhandi
its just take image from gallery or camera and save to file (in flutter)

flutter_img_pdf A new Flutter project. Getting Started This project is a starting point for a Flutter application. A few resources to get you started

vivek kumar 0 Dec 28, 2021
Flutter simple image crop - A simple and easy to use flutter plugin to crop image on iOS and Android

Image Zoom and Cropping plugin for Flutter A simple and easy used flutter plugin to crop image on iOS and Android. Installation Add simple_image_crop

null 97 Dec 14, 2021
Plugin to cut a portion of a picture from the camera

mask_for_camera_view Plugin to cut a portion of a picture from the camera. Getting Started This plugin works on Android & iOS. Used to crop an image f

Firdavs 7 Dec 10, 2022
Flutterbodydetection - A flutter plugin that uses MLKit on iOS/Android platforms to enable body pose and mask detection using Pose Detection and Selfie Segmentation APIs for both static images and live camera stream.

body_detection A flutter plugin that uses MLKit on iOS/Android platforms to enable body pose and mask detection using Pose Detection and Selfie Segmen

null 18 Dec 5, 2022
Real-time object detection in Flutter using camera and tflite plugin

For details: https://medium.com/@shaqian629/real-time-object-detection-in-flutter-b31c7ff9ef96 flutter_realtime_detection Real-time object detection i

Post_Swift 6 Oct 12, 2022
Save-money - A flutter app where you can track and save your money daily

SaveDay | Track Money Daily SaveDay is an app where you can track and save your

Aleyna Eser 0 May 30, 2022
A full-fledged camera app built with Flutter using the camera package.

Flutter Camera Demo A full-fledged camera app built with Flutter using the camera package. You can even add custom features to this app and customize

NguyenHoangDuc 5 Nov 23, 2022
Flutter pretty qr - Pretty QR code with round edges.

pretty_qr_code Pretty QR code for Flutter. You can round the edges with parameter or use the standard view. Features Created with QR dart Screenshots

null 42 Oct 30, 2022
A flutter plugin to crop image on iOS and Android.

Image Cropping plugin for Flutter A flutter plugin to crop image on iOS and Android. The plugin comes with a Crop widget. The widget renders only imag

Volodymyr Lykhonis 292 Dec 27, 2022
Flutter plugin, support android/ios.Support crop, flip, rotate, color martix, mix image, add text. merge multi images.

image_editor The version of readme pub and github may be inconsistent, please refer to github. Use native(objc,kotlin) code to handle image data, it i

FlutterCandies 317 Jan 3, 2023
A widget based on Flutter's new Interactive Viewer that makes picture pinch zoom, and return to its initial size and position when released.

pinch_zoom A widget based on Flutter's new Interactive Viewer that makes picture pinch zoom, and return to its initial size and position when released

Teun Kortekaas 36 Dec 30, 2022
Picture upload widget for Flutter which helps selecting and uploading one or multiple images to firebase storage.

Flutter Firebase Picture Uploader This library offers a Picture Upload widget which can be used to upload one or multiple images to your Firebase Stor

Christoph Rothermel 12 Oct 21, 2022
Automatically generate profile picture with random first name and background color. But you can still provide pictures if you have them. As the default color, based on the name of the first letter. :fire: :fire: :fire:

FLUTTER PROFILE PICTURE Automatically generate profile picture with random first name and background color. But you can still provide pictures if you

Aditya Dharmawan Saputra 10 Dec 20, 2022
An Android app that allows you to scan Japanese words from a picture and search for its meaning from a dictionary.

Jisho Lens is an app that allows you to scan Japanese words from a picture and search for its meaning from a dictionary. In a nutshell, think of it as

elianiva 12 Sep 22, 2022
Flutter plugin for selecting images from the Android and iOS image library, taking new pictures with the camera, and edit them before using such as rotation, cropping, adding sticker/text/filters.

advance_image_picker Flutter plugin for selecting multiple images from the Android and iOS image library, taking new pictures with the camera, and edi

Weta Vietnam 91 Dec 19, 2022
Flutter plugin to simply integrate Agora Video Calling or Live Video Streaming to your app with just a few lines of code.

Agora UI Kit for Flutter Instantly integrate Agora video calling or video streaming into your Flutter application. Getting started Requirements An Ago

Agora.io Community 106 Dec 16, 2022
A Flutter plugin to use iOS 16.1+ Live Activities ⛹️ & iPhone 14 Pro Dynamic Island ⚫️ features

Live Activities A Flutter plugin to use iOS 16.1+ Live Activities & iPhone 14 Pro Dynamic Island features. ?? What is it ? This plugin use iOS Activit

Dimitri Dessus 53 Dec 26, 2022