KePeng1019 / SmartPaperScan

this is an android project write in kotlin which detect paper or rectangle by opencv, you can take a picture and crop it
Apache License 2.0
163 stars 48 forks source link

java.lang.RuntimeException: setParameters failed #3

Closed Patil-Kranti closed 6 years ago

Patil-Kranti commented 6 years ago

E/SurfaceView: Exception configuring surface java.lang.RuntimeException: setParameters failed at android.hardware.Camera.native_setParameters(Native Method) at android.hardware.Camera.setParameters(Camera.java:2102) at com.pengke.paper.scanner.scan.ScanPresenter.initCamera(ScanPresenter.kt:124) at com.pengke.paper.scanner.scan.ScanPresenter.surfaceCreated(ScanPresenter.kt:129) at android.view.SurfaceView.updateSurface(SurfaceView.java:670) at android.view.SurfaceView$2.onPreDraw(SurfaceView.java:143) at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:977) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2474) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1460) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:7183) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:949) at android.view.Choreographer.doCallbacks(Choreographer.java:761) at android.view.Choreographer.doFrame(Choreographer.java:696) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:935) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:6669) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:858)

KePeng1019 commented 6 years ago

it seems I set wrong configuration for some device, I just update the preview and picture size configuration, this maybe help. can you please pull the newest code and have a try? thank you

Patil-Kranti commented 6 years ago

I did clone latest repository but error is still there. can you help? thanks..

KePeng1019 commented 6 years ago

so what is your device resolution? error is caused by i set wrong camera resolution configuration, or may be you can just try another device see what is happening.

Patil-Kranti commented 6 years ago

My resolution is 1920x1080 I tried 640x480 and 720x960 but the error still persist

On Fri 7 Sep, 2018, 7:40 AM KePeng1019, notifications@github.com wrote:

so what is your device resolution? error is caused by i set wrong camera resolution configuration, or may be you can just try another device see what is happening.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/KePeng1019/SmartPaperScan/issues/3#issuecomment-419297928, or mute the thread https://github.com/notifications/unsubscribe-auth/AXtFHqDMMCzIomIF1jUjNEjNn35H8IQ6ks5uYdWmgaJpZM4WaHNw .

KePeng1019 commented 6 years ago

i am wondering if you are using a virtual device? this project is not work on virtual device, so if you are using a virtual device, you should replace with a real one

Patil-Kranti commented 6 years ago

yes i was tring it on android emulator i'll check on my phone

Patil-Kranti commented 6 years ago

it worked thanks but I am not able to find the scanned images can you give the location where you save the images

KePeng1019 commented 6 years ago

there are several images on detecting rectangle process including origin image, cropped image and enhanceed image, i do not save it to disks due to i donot know which one you want. i think you can change the code and save it disk on your need or it's my pleasure to help you save these picture to disks on your need. so if you need my help to do this, you can tell me which picture you want to save to disk.

KePeng1019 commented 6 years ago

sorry for my poor English~~

Patil-Kranti commented 6 years ago

I don't how to code in kotlin if you could tell me how to save the enhanced image to the disk. it would be of great help. and also the menu option is not displaying in the app.

KePeng1019 commented 6 years ago

ok, when i finished, i will tell you.

KePeng1019 commented 6 years ago

I don't how to code in kotlin if you could tell me how to save the enhanced image to the disk. it would be of great help. and also the menu option is not displaying in the app.

I add a menu to save picture, so you can save the picture to your disk. path is: /storage/emulated/0/smart_scanner you can update and have a try.

Patil-Kranti commented 6 years ago

thanks for the help but the auto cropping is not working now

KePeng1019 commented 6 years ago

thanks for the help but the auto cropping is not working now uh, it not auto cropping, it just makr the picture largest rectangle, you should crop it by click the crop button then crop the rectangle including part.

Patil-Kranti commented 6 years ago

yes that's what I am saying that it is not detecting the paper

KePeng1019 commented 6 years ago

yes that's what I am saying that it is not detecting the paper

ok, it not work for every paper. May be algorithm can not detect the rectangle of the preview frame or the picture you take, so it not always works. I do not change the algorithm, so maybe it just can not work for the paper you puton

Patil-Kranti commented 5 years ago

hi can you tell me how to add activity to view scanned images