opencv4android

OpenCV4Android Kmean doesn't work as expected

空扰寡人 提交于 2019-12-05 06:43:03
问题 This code should give centers mat with 3 rows and clusterCount number of columns Mat reshaped_image = imageMat.reshape(1, imageMat.cols()*imageMat.rows()); Mat reshaped_image32f = new Mat(); reshaped_image.convertTo(reshaped_image32f, CvType.CV_32F, 1.0 / 255.0); Mat labels = new Mat(); TermCriteria criteria = new TermCriteria(TermCriteria.COUNT, 100, 1); Mat centers = new Mat(); int clusterCount = 5, attempts = 1; Core.kmeans(reshaped_image32f, clusterCount, labels, criteria, attempts, Core

Android document scanner using opencv

佐手、 提交于 2019-12-05 04:57:01
I am in the process of trying to develop a document scanner within an application of mine. As an example of what I want to achieve you can take a look at the Google document t scanner built into the Google drive app. This allows Detect edges Manipulate into perspective Display top down view of document I have been looking at a number of 3rd party api to see if this can be achieved but they seem more focused on OCR. Which is not a priority of mine. I have however stumbled across this document scanner Where it makes a document scanner using java open cv. Within the comments someone asked about

drawContours around detected document using opencv for android gives strange bug

爱⌒轻易说出口 提交于 2019-12-04 19:19:05
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(), mCacheBitmap.getHeight(), matrix, true); 2) now in drawbitmap method replace above bitmap with

OpenCV Android native code build issue

扶醉桌前 提交于 2019-12-04 03:27:11
问题 I am learning how to write C++ code using OpenCV and I want to run it in Android. I use Android Studio. I have created a new simple project with C++ support and then I added my test code to the C++ file. My own files compile and link, it seems. Now something else that I don't think is related to my project is causing many errors. It seems to be something inside NDK. Could it be a bug in the latest version, and if so, what can I do about it? C:/Android/sdk/ndk-bundle/toolchains/x86-4.9

Human body detection using OpenCV in Android

陌路散爱 提交于 2019-12-03 17:14:35
I want to create an Android application in which i want to detect human body from an image. I haven't started coding yet(its just an idea), so i am not able to show you any codes. I heard about OpenCV face detection for android. I have tried to use OpenCV face detection, But since i am newbie in android, i am not able to do so. My question is "Is there anything in OpenCV that can help me to detect whole human body rather than just face?", if YES then "is there any tutorials regarding this?" thanks for HELP in advance. Muhammad Younas Yes, it is possible to detect the human body in the form of

How to get well-defined edges regardless of the color

*爱你&永不变心* 提交于 2019-12-02 01:02:59
问题 I am trying to develop an App that detects cards "master cards, visa, cutomer cards, etc" using Android Camera, for that purpose i used OpenCV4Android version 3.0.0. To achieve this task, i did the following: 1- converted the frame taken from the camera to gray scale using Imgproc.cvtColor(this.mMatInputFrame, this.mMatGray, Imgproc.COLOR_BGR2GRAY); 2- blurring the frame using Imgproc.blur(this.mMatGray, this.mMatEdges, new Size(7, 7)); 3- apply Canny edge detector as follows Imgproc.Canny

OpenCV Android native code build issue

☆樱花仙子☆ 提交于 2019-12-01 17:43:40
I am learning how to write C++ code using OpenCV and I want to run it in Android. I use Android Studio. I have created a new simple project with C++ support and then I added my test code to the C++ file. My own files compile and link, it seems. Now something else that I don't think is related to my project is causing many errors. It seems to be something inside NDK. Could it be a bug in the latest version, and if so, what can I do about it? C:/Android/sdk/ndk-bundle/toolchains/x86-4.9/prebuilt/windows-x86_64/lib/gcc/i686-linux-android/4.9.x/../../../../i686-linux-android/bin\ld: error: C:

Execution failed for ':app:ndkBuild'. Process 'command ndk-build.cmd' finished with non-zero exit value 2

那年仲夏 提交于 2019-12-01 06:14:27
I have been stuck on this problem for 2 days and have tried out all possible solutions given on stackoverflow. Below is my build.gradle file: apply plugin: 'com.android.application' android { compileSdkVersion 25 buildToolsVersion "25.0.3" sourceSets.main.jni.srcDirs = [] sourceSets.main.jniLibs.srcDir 'src/main/libs' defaultConfig { applicationId "com.example.anannyauberoi.testingcam" minSdkVersion 15 targetSdkVersion 25 versionCode 1 versionName "1.0" ndk { moduleName "app" cFlags "-std=c++11 -fexceptions" ldLibs "log" stl "gnustl_shared" abiFilter "armeabi-v7a" } } buildTypes { release {

How to Iterate in OpenCV4Android

爱⌒轻易说出口 提交于 2019-12-01 01:38:10
I had this piece of code to be converted into Java using OpenCV4Android. But their are no Java-Wrappers for matiterator in OpenCV4Android. void show_result(const cv::Mat& labels, const cv::Mat& centers, int height, int width) { std::cout << "===\n"; std::cout << "labels: " << labels.rows << " " << labels.cols << std::endl; std::cout << "centers: " << centers.rows << " " << centers.cols << std::endl; assert(labels.type() == CV_32SC1); assert(centers.type() == CV_32FC1); cv::Mat rgb_image(height, width, CV_8UC3); cv::MatIterator_<cv::Vec3b> rgb_first = rgb_image.begin<cv::Vec3b>(); cv:

How to detect (Count) Hair from image using OpenCV?

别说谁变了你拦得住时间么 提交于 2019-11-30 14:10:30
I have try below code using OpenCV functions cvtColor , Canny and HoughLinesP but not able to get accurate result or not work in some cases. private boolean opencvProcessCount(Uri picFileUri) { hairCount = 0; totalC = 0; //Log.e(">>>>>>>>","count " + picFileUri); try { InputStream iStream = getContentResolver().openInputStream(picFileUri); byte[] im = getBytes(iStream); BitmapFactory.Options opt = new BitmapFactory.Options(); opt.inDither = true; opt.inPreferredConfig = Bitmap.Config.ARGB_8888; Bitmap image = BitmapFactory.decodeByteArray(im, 0, im.length); Mat mYuv = new Mat(); Utils