运行前请先安装OpenCV Manager(必须)。
本示例基于OpenCV 3.2.0 版本在Android平台实现目标检测和目标追踪
- 人脸检测
- 眼睛检测
- 微笑检测
- 上半身检测
- 下半身检测
- 全身检测
- CamShift算法实现目标追踪
目标检测
目标追踪
人脸识别(对比)请切换到master分支,基于OpenCV 2.4.11。
目标检测&目标追踪&人脸检测&人脸识别
Home Page: http://kongqw.com/2016/09/09/2016-09-09-OpenCV-JavaCV实现人脸识别/
运行前请先安装OpenCV Manager(必须)。
本示例基于OpenCV 3.2.0 版本在Android平台实现目标检测和目标追踪
目标检测
目标追踪
人脸识别(对比)请切换到master分支,基于OpenCV 2.4.11。
大佬,还在不在,为啥图像是个反的啊
就是如何用它进行拍照操作。
小米pad 3,安装了OpenCV_3.2.0_Manager_3.20_armeabi.apk,
打开apk还是报 加载opencv失败
不想让摄像头长时间开着,所以想在不用的时候关闭,用的时候快速调起摄像头,进行拍照预览
把各种格式的arm 或者 v7 等都装了一遍,还是没有显示安装Opencv manager,
测试手机为 魅蓝note5, flyme7,android 7.0 @kongqw ,
您看有这个问题么
我在运行这个demo的时候报如下错误:
01-17 14:45:15.439 29184-29184/kong.qingwei.kqwfacedetectiondemo E/AndroidRuntime: FATAL EXCEPTION: main
Process: kong.qingwei.kqwfacedetectiondemo, PID: 29184
java.lang.RuntimeException: Unable to start activity ComponentInfo{kong.qingwei.kqwfacedetectiondemo/kong.qingwei.kqwfacedetectiondemo.MainActivity}: android.view.InflateException: Binary XML file line #45: Error inflating class kong.qingwei.kqwfacedetectiondemo.CameraFaceDetectionView
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2664)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2733)
at android.app.ActivityThread.access$900(ActivityThread.java:187)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1584)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5869)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1019)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:814)
Caused by: android.view.InflateException: Binary XML file line #45: Error inflating class kong.qingwei.kqwfacedetectiondemo.CameraFaceDetectionView
at android.view.LayoutInflater.createView(LayoutInflater.java:639)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:812)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:815)
at android.view.LayoutInflater.inflate(LayoutInflater.java:510)
at android.view.LayoutInflater.inflate(LayoutInflater.java:420)
at android.view.LayoutInflater.inflate(LayoutInflater.java:371)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:437)
at android.app.Activity.setContentView(Activity.java:2205)
at kong.qingwei.kqwfacedetectiondemo.MainActivity.onCreate(MainActivity.java:36)
at android.app.Activity.performCreate(Activity.java:6127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2617)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2733)
at android.app.ActivityThread.access$900(ActivityThread.java:187)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1584)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5869)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1019)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:814)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:812)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:815)
at android.view.LayoutInflater.inflate(LayoutInflater.java:510)
at android.view.LayoutInflater.inflate(LayoutInflater.java:420)
at android.view.LayoutInflater.inflate(LayoutInflater.java:371)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:437)
at android.app.Activity.setContentView(Activity.java:2205)
at kong.qingwei.kqwfacedetectiondemo.MainActivity.onCreate(MainActivity.java:36)
at android.app.Activity.performCreate(Activity.java:6127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2617)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2733)
at android.app.ActivityThread.access$900(ActivityThread.java:187)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1584)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5869)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1019)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:814)
Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=org.opencv.engine.BIND }
at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1851)
at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1951)
at android.app.ContextImpl.bindService(ContextImpl.java:1929)
at android.content.ContextWrapper.bindService(ContextWrapper.java:539)
at org.opencv.android.AsyncServiceHelper.initOpenCV(AsyncServiceHelper.java:24)
at org.opencv.android.OpenCVLoader.initAsync(OpenCVLoader.java:89)
at kong.qingwei.kqwfacedetectiondemo.CameraFaceDetectionView.loadOpenCV(CameraFaceDetectionView.java:53)
at kong.qingwei.kqwfacedetectiondemo.CameraFaceDetectionView.(CameraFaceDetectionView.java:46)
at java.lang.reflect.Constructor.newInstance(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:288)
at android.view.LayoutInflater.createView(LayoutInflater.java:613)
at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:749)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:812)
at android.view.LayoutInflater.rInflate(LayoutInflater.java:815)
at android.view.LayoutInflater.inflate(LayoutInflater.java:510)
at android.view.LayoutInflater.inflate(LayoutInflater.java:420)
at android.view.LayoutInflater.inflate(LayoutInflater.java:371)
at com.android.internal.policy.impl.PhoneWindow.setContentView(PhoneWindow.java:437)
at android.app.Activity.setContentView(Activity.java:2205)
at kong.qingwei.kqwfacedetectiondemo.MainActivity.onCreate(MainActivity.java:36)
at android.app.Activity.performCreate(Activity.java:6127)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1123)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2617)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2733)
at android.app.ActivityThread.access$900(ActivityThread.java:187)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1584)
at android.os.Handler.dispatchMessage(Handler.java:111)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5869)
at java.lang.reflect.Method.invoke(Native Method)
编译版本build.gradle:
android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
defaultConfig {
applicationId "kong.qingwei.kqwfacedetectiondemo"
minSdkVersion 15
targetSdkVersion 25
versionCode 1
versionName "1.0"
ndk {
// 设置支持的 SO 库构架
abiFilters 'armeabi-v7a'// 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64', 'mips', 'mips64'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
好像只能横屏使用,这个可以改成竖屏吗
怎么保存人脸图片啊,不带框框的那种
这个库在哪儿啊
实例化CascadeClassifier的时候,这个对象一直是empty的。
有朋友遇到这个问题吗?求告知下
作者你好,这里报错有什么办法吗?
(as2.3.0,opencv3.2.0)
Error:Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'.
com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK lib/armeabi/libjniavcodec.so
File1: /Users/tom/.gradle/caches/modules-2/files-2.1/org.bytedeco.javacpp-presets/ffmpeg/3.2.1-1.3/a529ed8c20539530ca4f422b0567fa03e7bf0b44/ffmpeg-3.2.1-1.3-android-arm.jar
File2: /Users/tom/Development/open_android_demo/AI/opencv/MyOpenCV320/openCVLibrary320/build/intermediates/bundles/default/jni
我的gradle按照你的配置的
现在如果是前置摄像头的话,人脸的移动方向和摄像头预览的方向是相反的。就是人脸向右移动,摄像头中预览的人脸是向左移动的。
项目跑起来没报错,但是在使用过程中要我安装OpenCV Manager。难道这个库没有包含在项目中吗?
目标跟踪的时候,很容易丢失目标,效果不好。期待,大神下次更新。
已经安装了OpenCV_3.2.0_Manager_3.20,还是提示未安装
大神,运行会崩溃..
这个库没有啊
老大,能否问一下,为啥Highgui.imread调不了,我加进去也不行,说我没有实现
还Core.rectangle 也没有啊
No implementation found for void org.opencv.core.Core.rectangle_2
能不能更新一下啊,或者指教一下怎么实现
"/data/app/org.opencv.engine-1/lib/arm/libopencv_java3.so" is 32-bit instead of 64-bit
大神,现在是主界面中会用绿框标记出人脸,我想在框住的人脸上面标记出特整点,比如说眼睛嘴巴这好实现吗?能否给个思路
camshift能有效解决目标变形和遮挡的问题,对系统资源要求不高,时间复杂度低,在简单背景下能够取得良好的跟踪效果。但当背景较为复杂,或者有许多与目标颜色相似像素干扰的情况下,会导致跟踪失败。因为它单纯的考虑颜色直方图,忽略了目标的空间分布特性,所以这种情况下需加入对跟踪目标的预测算法。
Is it a charge?
When I compile this project with the blew config, I get this error.
targetSdkVersion 23
but when I change to targetSdkVersion 19, everything goes well.
Process: kong.qingwei.kqwfacedetectiondemo, PID: 28546
java.lang.UnsatisfiedLinkError: dlopen failed: library "../../lib/libopencv_core.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:977)
at java.lang.System.loadLibrary(System.java:1530)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
at com.googlecode.javacpp.Loader.load(Loader.java:586)
at com.googlecode.javacpp.Loader.load(Loader.java:540)
at com.googlecode.javacv.cpp.opencv_highgui.(opencv_highgui.java:79)
at com.googlecode.javacv.cpp.opencv_highgui.cvLoadImage(Native Method)
at kong.qingwei.kqwfacedetectiondemo.FaceUtil.CmpPic(FaceUtil.java:100)
at kong.qingwei.kqwfacedetectiondemo.MainActivity.onFace(MainActivity.java:119)
at kong.qingwei.kqwfacedetectiondemo.CameraFaceDetectionView.onCameraFrame(CameraFaceDetectionView.java:151)
at org.opencv.android.CameraBridgeViewBase.deliverAndDrawFrame(CameraBridgeViewBase.java:387)
at org.opencv.android.JavaCameraView$CameraWorker.run(JavaCameraView.java:346)
at java.lang.Thread.run(Thread.java:761)
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: library "../../lib/libopencv_core.so" not found
at java.lang.Runtime.loadLibrary0(Runtime.java:977)
at java.lang.System.loadLibrary(System.java:1530)
at com.googlecode.javacpp.Loader.loadLibrary(Loader.java:711)
at com.googlecode.javacpp.Loader.load(Loader.java:577)
您好,我目前想做一些关于ROI的视频传输的系统,但是在实现上需要一些理论支持!
在读取视频流的时候,判读取的视频数据包是不是属于圈定出来的ROI区域,然后再做后续处理!不知道openCV是否有解决办法,或者其他工具是否支持!
具体的一个用途,举个例子就是:当在视频传输过程中,如果需要主动丢包,我会优先丢弃非ROI区域,但是在读取视频数据包的时候,我怎么知道这些数据包里哪一部分是指代ROI区域呢?
或者最简单的是,我人为圈定中心20X20的区域,我在读取数据包的时候如何知道该数据包是否是20*20的区域呢?
1.直接运行正常显示
2.gradle build 编译出debug 和release 版本,debug正常,release 版本一片漆黑
预览画面中选择目标,提示已经选中跟踪目标,随后立马出现目标丢失!
运行起来了人脸比对的项目 master分支,但是摄像头黑屏
老大,能否问一下,为啥Highgui.imread调不了,我加进去也不行,说我没有实现
还Core.rectangle 也没有啊
No implementation found for void org.opencv.core.Core.rectangle_2
能不能更新一下啊,或者指教一下怎么实现
现在的版本 需要装manage apk 然后各种问题,还使用不了相机,黑屏。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.