Not able to find Face and FaceRecognition classes - java

I am working on Face Recognition java project using OpenCV 3.4.0. For that using createFisherFaceRecognizer(0,1500) method but OpenCV doesn't contain this class and method. Does anyone know about OpenCV? Please let me know how to use it.
These are imports
import org.opencv.face.Face;
import org.opencv.face.FaceRecognizer;
Thanks in advance.

There is another thing called OpenCV-contrib that is required to run the following Face class .
This is the GitHub repo link . Read the README.md
Follow the given steps : -
Download the original OpenCV repo and the contrib repo from GitHub.
Go to opencv_contrib/modules/face and open cmakeLists.txt with any editor . Now find the line that begins with ocv_define_module and add the word 'java' (no quotes) in the end .
[Looks like:-
ocv_define_module(face opencv_core opencv_imgproc opencv_objdetect WRAP python java)]
3.Compile using cmake using this : cmake -D CMAKE_BUILD_TYPE=Release -D OPENCV_EXTRA_MODULES_PATH=path to opencv_contrib
Use the generated jar!
PS:In windows , I don't think the default .exe opencv installer contains the face classes , so its better to build with cmake .

org.opencv.face is not available with OpenCV. For that, opencv-contrib is required which can be easily added. Follow the link:
opencv-contrib library

Related

opencv 3.2.0 java Face Recognition Ubuntu

i am using opencv 3.2.0 and im trying to get the face recognition up and running.
I am faced with the problem that the Face class in org.opencv.face.Face being empty. This is all contained in the file :
//
// This file is auto-generated. Please don't modify it!
//
package org.opencv.face;
public class Face {
}
From what i have read i need to add 'java' to the CMakeLists.txt of Face contrib module in order to add it to the final jar such as
ocv_define_module(face opencv_core opencv_imgproc opencv_objdetect WRAP python java)
In order to tell the compiler to include the contrib modules i have to add
-D
OPENCV_EXTRA_MODULES_PATH=$YOUR_OPENCV_CONTRIB_PATH/opencv_contrib-
3.2.0/modules
to the cmake command , and later make it , in general my commands are as follows
1: cmake
2: make -j5
I get no errors when compiling and building and i get my jar,
which i use without issues for face detection and so forth.
The problem is that the Face class is empty and i cannot create a FaceRecognizer.
i was following this guide here
https://github.com/andreaiacono/OpenCVDemo - as of 01.06.2017
and in the org.opencv.demo.core.RecognizerFactory class he uses
return Face.createFisherFaceRecognizer();
which as it seems i can not use.
I tried to search if the 3.2.0 libraries have a different way of creating a recognizer but google is not very helpful as there are just a handful of answers to any java opencv related issues.
What could be causing the Face class to be empty and/or are there any other ways to create recognizers in case that 3.2.0 indeed works differently ?
Thank you for the time
I have found an answer to my previous question and i am posting it for all to see , i hope i could help some other lost soul like myself.
I have tested with version 3.1.0 and it would appear that the Face class is NOT empty. Proving that Face detection in 3.2.0 may not be implemented properly (as of the time of writing).
I faced issues with compiling properly due to usage of some libraries :
/usr/include/c++/6.1.1/cstdlib:75:25: fatal error: stdlib.h: No such file or directory
#include_next <stdlib.h>
An answer i found to this issue was found in https://github.com/opencv/opencv/issues/6517#issuecomment-219219767
namely to include this in the cmake :
cmake -DENABLE_PRECOMPILED_HEADERS=OFF
This allowed me to compile everything properly and i managed to get my face recognition code up and running :)
Good luck to all

Android JavaCV - UnsatisfiedLinkError and couldn't find "libopencv_core.so"

I use JavaCV 1.1. I have added jar files (javacv.jar, javacpp.jar and opencv.jar) and *.so libraries to my project in Android Studio. I succesfully build and run my app on Android 5.1 phone, but when i try use functions, that used OpenCV i get error:
java.lang.UnsatisfiedLinkError:dalvik.system.PathClassLoader[DexPathList[[zipfile"/data/app/com.example.dogan.ligntningshower-/base.apk"],nativeLibraryDirectories=[/vendor/lib, /system/lib]]] couldn't find "libopencv_core.so"
I try to add
static {
System.loadLibrary("opencv_core");
System.loadLibrary("jniopencv_core");
}
but it's no work. How to fix it?
I just add *.so libs to folder /app/src/main/jniLibs/armeabi and now all works fine!
if someone still looking for the answer, first you should check if you added correct files to jniLibs folders. heres a complete tutorial :
A Beginner’s Guide to Setting up OpenCV Android Library on Android Studio
second, if .os files are at their places in each and every folder then you should only change the names to the name that is showing up in the compiler error.
in my case the names were libopencv_java3.so and yet the compiler was saying couldn't find "libopencv_java343.so" . after changing the name to libopencv_java343.so it worked.

Cannot resolve com.parse.ParseQueryAdapter

My current setup :
OS : windows 7
IDE : Android Studio (with updated SDKs)
Parse jar (v 1.10)
I am trying out an example for ParseQueryAdapter, and I run into this error on my IDE : import com.parse.ParseQueryAdapter; -> cannot resolve symbol ParseQueryAdapter
I want to try something similar to this example, and the import does not seem to go through because of the error.
If you need anymore information, please leave comments & I will respond.
PS : I am able to add com.parse.ParseObject without errors.
In your libs folder you'll find Parse-1.4.1.jar file.
Right click or control+click on it then 'Add as Library...'
Edit: Parse-1.10 does not have ParseQueryAdapter. You have to use Parse-1.4.1, which is included in that example.
ParseQueryAdapter was removed from the official Parse SDK and moved onto the Parse-UI libraries..
You can install them on via this link: https://github.com/ParsePlatform/ParseUI-Android
If we include 1.4.1, and keep 1.10.1 as well, it gives error because we cannot keep the same jar with two versions in the libs folder. And I think its not advisable to use just 1.4.1. I feel that ParseQueryAdapter is deprecated and we would just have to use the normal adapters. Any comments?

com.android.ant.SetupTask cannot be found

I would need to build one android app from command line. I successfully compiled its jni part, but cannot build Java part. ant prints the following (paths have been removed):
/.../build.xml:69: taskdef class com.android.ant.SetupTask cannot be found
using the classloader AntClassLoader[/path/to/sdk/tools/lib/ant-tasks.jar:/path/to/sdk/tools/lib/manifest-merger.jar:/path/to/sdk/tools/lib/common.jar:/path/to/sdk/tools/lib/guava-13.0.1.ja r:/path/to/sdk/tools/lib/sdklib.jar:/path/to/sdk/tools/lib/layoutlib-api.jar:/path/to/sdk/tools/lib/kxml2-2.3.0.jar:/path/to/sdk/tools/lib/dvlib.jar:/path/to/sdk/tools/lib/bcpkix-jdk15on-1.4 8.jar:/path/to/sdk/tools/lib/commons-compress-1.0.jar:/path/to/sdk/tools/lib/httpclient-4.1.1.jar:/path/to/sdk/tools/lib/httpmime-4.1.jar:/path/to/sdk/tools/lib/bcprov-jdk15on-1.48.jar:/path /to/sdk/tools/lib/httpcore-4.1.jar:/path/to/sdk/tools/lib/commons-logging-1.1.1.jar:/path/to/sdk/tools/lib/commons-codec-1.4.jar]
It seems that SetupTask is inside anttasks.jar, but it is not in my sdk directory. I tried to install all available sdks, tried to add ant-tasks.jar to the class path (it has similar name), but with no success. Is there any way how to install anttasks.jar, or is it replaced by something else? Or is SetupTask obsolete in some way?
I have run:
android update project ...
I tried to find answer by google but with no success for this particular issue (AntClassLoader is not empty, anttasks.jar is missing).
Thanks,
Daniel
Afaik the SetupTask ist obsolete in Android 2.3 and higher. So it seems to me like you're working with an old version of the build.xml. Since Android 2.3 and higher, there is a new template for the build.xml in the directory
your-android-SDK/tools/ant/. You can modify this one according to your needs.
Maybe this link will help you, it pointed me in the right direction:
https://sites.google.com/site/sokolkosta/internal-blog/includingadditionaljavaxpackagesinandroid23
https://stackoverflow.com/a/15719072/1343309
It worked for me.
rm MyProjects/NowRedux/build.xml
android update project --target 8 --path MyProjects/NowRedux

Stuck at converting/implementing Qt (.ui) files to Qtjambi(.jui) files

Edit 01.02.2012:
FWIW: 4.7.0 linux packages are broken AFAIK, they
can be fixed or 4.6 packages used instead...
No need to use
custom Qt for Jambi – Smar 2 days ago
Thanks to SMAR, I was finally able to resolve this
issue by downloading the an older version of
qtjambi 4.6.3 ( http://qt-jambi.org/downloads/ ). The only problem was that the
designer did not know where to find my jvm which
I solved by adding these two entries to /etc/bash.bashrc:
# custom PATH exports
export JAVA_HOME=/usr/lib/jvm/java-6-sun
PATH=$PATH:$JAVA_HOME/bin
Then I just had to run (everything was in the qtjambi-folder):
designer.sh --> save it as .jui --> convert it with juic into a .java file --> and load it with netbeans :)
Hope this is somehow helpful to others too.
Thanks for the great and fast help!
Original post:
Good evening,
I am not completely sure if this topic is enough about programming but I am having some problems setting up Qtjambi. I have followed a lot of "howtos" and instructions so I am a little confused about what to do next. Qtjambi works as I have written a example program with netbeans. Although I have created some ui files that I want to implement which doesnt work.
I am trying to get this to run for like a week and I really need this because of my finals in 2 months. I try to give as much useful details as possible.
I am using LinuxMint (ubuntu derivate), downloaded qtjambi v 4.7.0
after trying out
bash qtjambi.sh
I got an error of mismatching versions
Cannot mix incompatible Qt library (version 0x40704) with this library (version 0x40700)
So I downloaded, compiled and installed
qt-everywhere-opensource-src-4.7.0 to /usr/local/Trolltech/Qt-4.7.0/
I know that I have to tell the system where to find all the binarys so I added to the /etc/bash.bashrc
#custom PATH exports
PATH=$PATH:/home/michi/Scripts
PATH=$PATH:/usr/local/Trolltech/Qt-4.7.0/bin/
export LD_LIBRARY_PATH=/usr/local/Trolltech/Qt-4.7.0/lib
export QT_PLUGIN_PATH=/usr/local/Trolltech/Qt-4.7.0/plugins
JAVA_DIR=/usr/lib/jvm/java-6-sun-1.6.0.26/
export JAMBI_PATH=/usr/local/lib/qtjambi-linux64-community-4.7.0/
I followed through the instructions of:
http://www.davidlauzon.net/2010/01/getting-started-with-qt-jambi-on-linux/
Which generally talks about getting jambi-designer to work.
http://jpnurmi.kapsi.fi/blog/2008/03/16/how-to-switch-qt-version-in-ubuntu/
How to manage multiple Qt versions.. These commands worked but had no effect
I finally gave up on trying to run the designer and tried to "convert" the .ui files to .jui files with the program juic which is located in the qtjambi/bin folder. But also here I get an error:
michi#BALMORA ~/Documents/unterlagen/pr_scw/Qt/Qtrainer/test $ which juic
/usr/local/bin/juic
michi#BALMORA ~/Documents/unterlagen/pr_scw/Qt/Qtrainer/test $ juic -cp .
juic: no .jui files found in CLASSPATH
michi#BALMORA ~/Documents/unterlagen/pr_scw/Qt/Qtrainer/test $ /usr/locallib/qtjambi-linux64-community-4.7.0/bin/juic -cp .
juic: no .jui files found in CLASSPATH
It would be great if you could help/guide or redirect me to "better" instructions.
Michael Kargl

Categories