opencv4android

How to retrieve a new picture taken by the camera as OpenCV Mat on Android?

北慕城南 提交于 2019-12-11 03:18:00
问题 I am trying to take a picture with an Android device. The picture must be converted as Mat to be an input for a computation of which I like to provide the results within an API. In which format does Android provide the byte[] data in it's callback and how to convert it to an OpenCV Mat in the color-format BGR? The first problem: "How to take the picture without a SurfaceView" is solved. I used a SurfaceTexture, which must not be visible. mCamera = Camera.open(); mCamera.setPreviewTexture(new

How to rebuild OpenCv with c++_static?

有些话、适合烂在心里 提交于 2019-12-11 01:08:48
问题 I am new to opencv in android. I imported the opencv module 3.4.2 successfully. In application.mk APP_STL:=gnustl_static When I tried to build the application, I got NDK build error that 'gnustl_static' is no longer supported. I changed the above line in application.mk to APP_STL:=c++_static as suggested by android studio. The build was successful and I ran the project successfully. Now I tried to implement the face detection with opencv as like as opencv samples 'face-detection'. I got the

Running android native code is causing java.lang.UnsatisfiedLinkError

一笑奈何 提交于 2019-12-10 17:37:27
问题 I have an android app with native code where I use openCV library. When running the app in phone everything is working well but when I try to run it on tablet(Lenovo yoga 2 pro) I am encountering this error: 01-03 11:53:13.007: E/AndroidRuntime(25632): FATAL EXCEPTION: main 01-03 11:53:13.007: E/AndroidRuntime(25632): Process: <appname>, PID: 25632 01-03 11:53:13.007: E/AndroidRuntime(25632): java.lang.UnsatisfiedLinkError: dlopen failed: "/data/app-lib/<appname>/libnative_module.so" has

lockCanvas keeps throwing exceptions

妖精的绣舞 提交于 2019-12-10 14:45:43
问题 I copied sample code from opencv4android(face detection). I passed the NDK part. And run the app on phone. However SurfaceView only shows camera preview. It seems whatever done in OnCameraFrame is not affecting the Canvas on the SurfaceView. So I trace into their SDK. the problem is in deliverAndDrawFrame function. Does anybody had the same problem before? Canvas canvas = getHolder().lockCanvas(); if (canvas != null) { canvas.drawColor(0, android.graphics.PorterDuff.Mode.CLEAR); Log.d(TAG,

Error: package android.hardware.camera2 does not exist OpenCV

喜夏-厌秋 提交于 2019-12-09 02:12:14
问题 I'm trying to add the OpenCV module to a project, but I'm not able to solve some gradle issues. Here is my app.gradle file: apply plugin: 'com.android.application' android { compileSdkVersion 17 buildToolsVersion "23.0.2" defaultConfig { applicationId "com.sveder.cardboardpassthrough" minSdkVersion 8 targetSdkVersion 21 } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt' } } } dependencies { compile 'com.android

JavaCV in Android

限于喜欢 提交于 2019-12-08 11:37:47
问题 I downloaded JavaCV-1-3-1. Now I have 2 questions: How can I import JavaCV to Android Studio for using? Can be used from FFMPEG commands with JavaCV? 回答1: To import java cv add this to gradle dependencies { compile 'org.bytedeco:javacv:+' compile 'org.bytedeco.javacpp-presets:opencv:3.0.0-1.1:android-x86' compile 'org.bytedeco.javacpp-presets:ffmpeg:2.8.1-1.1:android-x86' compile 'org.bytedeco.javacpp-presets:opencv:3.0.0-1.1:android-arm' compile 'org.bytedeco.javacpp-presets:ffmpeg:2.8.1-1.1

detecting multi color document with OpenCV4Android

谁说胖子不能爱 提交于 2019-12-07 15:33:07
问题 I am new to OpenCv with Android.I am trying to make an application which auto detects documents using OpenCv - 2.4.13 . In my app, there is a functionality of detection documents (like a Scanbot app) and then prospect it to document. So, far I am able to detect documents with single colour or documents which are clearly distinguishable from background. But the problem arises when the document is of multi-color. To clearly understand the problem , I have attached an image: As you can see, the

drawContours around detected document using opencv for android gives strange bug

僤鯓⒐⒋嵵緔 提交于 2019-12-06 13:18:43
问题 I am new to OpenCv4Android. I am trying to auto detect document using OpenCv4Android sdk. Initially i have gone through issue of landscape opencv camera . Somehow i managed to change the orientation of opencv JavaCameraview to portrait. I made following changes in default classes of opencv sdk to orient opencv camera in portrait : 1) In CameraBridgeViewBase class Matrix matrix = new Matrix(); matrix.setRotate(90f); Bitmap bitmap = Bitmap.createBitmap(mCacheBitmap, 0, 0, mCacheBitmap.getWidth(

How to add OpenCV lib to AS3.1.2 and NDK 17.0

情到浓时终转凉″ 提交于 2019-12-06 10:12:18
I need to use OpenCV in Android Studio 3.1.2. I have the last version at 05/20/2018 of this IDE and the NDK (17.0.4754217). I read this post talking about it, and says something about a problem with the NDK version 16, but is not the case. Most of the guides are for older versions of Android (I saw guides talking about Eclipse IDE for Android development) but no one with the last version or one closest, and it is a problem, since the latest version of AS causes many errors with older projects or the way in which they are made, so they make these guides obsolete. Maybe is a problem caused by

openCV4Android features2d error

可紊 提交于 2019-12-06 07:17:52
I want to use features2d to draw good matches (not all matches) between two images.So I used this snippet of code: Mat gray1 = //image1 converted to gray Mat gray2 = //image2 converted to gray MatOfDMatch matches = new MatOfDMatch(); MatOfDMatch gm = new MatOfDMatch(); LinkedList<DMatch> good_matches = new LinkedList<DMatch>(); MatOfKeyPoint keypoints_object = new MatOfKeyPoint(); MatOfKeyPoint keypoints_scene = new MatOfKeyPoint(); Mat descriptors_object = new Mat(); Mat descriptors_scene = new Mat(); FeatureDetector fd = FeatureDetector.create(FeatureDetector.ORB); fd.detect(gray1, keypoints