Quantcast
Channel: OpenCV Q&A Forum - Latest question feed

face recognition

0
0
Who tells me where to find the source (C ++) of a program to do face recognition from webcam. Including training needed to recognize faces in the video. I would not lose too much time because looking on the internet it seems that many have already done something similar. So as to devote to its integration in a project of mine. Thank you

Combining FisherFaces and LBPH to improve accuracy

0
0
Hi everyone, i’m trying to implement a face recognition system for a video surveillance application. In this context test images are low quality, illumination change from an image to another, and, moreover, the detected subjects are not always in the same pose. As first recognizer i used FisherFaces and, with 49 test images, i obtain an accuracy of 35/49, without considering the distances of each classified subject (i just considered labels). Trying to get a better accuracy i attempt to make a preprocessing both of training images and test images; the preprocessing i choose is described in “Mastering OpenCV with Practical Computer Vision Projects” book. The steps are: 1. detection of the eyes in order to allign and rotate a face; 2. separate histogram equalization to standardize the lighting in the image; 3. filtering to reduce the effect of pixel noise because the histogram equalization increase it; 4. the last step is to apply an elliptical mask to the face in order to delete some details of the face that are not significant for the recognition. Well, with this type of preprocessing, i obtain worse results than before (4/49 subjects properly classified). So i thought of using another classifier, the LBPH recognizer, to improve the accuracy of the recognition since these two types of algorithms have different features and different ways to classify a face; if one use them together maybe the accuracy increase. So my question is about the ways to combine these two algorithms; anyone knows how to merge the two outputs in order to obtain better accuracy? I thought at this: if FisherFaces and LBPH give the same result (the same label) then there is no problem; otherwise if they disagree my idea is to take the vector of the labels and the vector of the distances for each algorithm and for each subject sum the corresponding distances; at this point the label of the test image is the one that has the shortest distance. This is just my idea but there are other ways to fuse the output of both algorithm also because i should change the code of the predict function of face module in OpenCV since it returns an int type not a vector of int.

How to reduce false positives for face detection

0
0
I'm using the `CascadeClassifier` object to detect faces in a video sequence, but I'm seeing a high rate of false positives. To combat this, I thought I would try to detect eye pairs within the ROI of the detected faces, but several of my videos seem to be too low resolution to do the eye detection. What is the recommended alternative for avoiding false positives?

AttributeError: 'module' object has no attribute 'face'

0
0
Hi, I compiled the opencv with contrib modules in the cmake GUI and everything seems ok, but when I try to use face module (cv2.face) I receive the following message:> AttributeError: 'module' object has no attribute 'face' Can someone help me please? I lost few days trying to solve that but nothing works. I'm using Windows 8.1 and Python 2.7 Thanks

EM:: OPENCV 2.4.11

0
0
Hi, i'm looking forward a simple tutorial that explains for noobs the Expectation Maximization, and how to implement it, to collect data from a picture for example, or real time camera. Thank you for your consideration ! I'm using Xcode and OpenCV 2.4.11

Add a public function to face recognition src-file

0
0
I have a c++ program from where I can create a LBPHFaceRecognizer, train it with with data, send an image for prediction etc. But now I want to customize lbph_faces.cpp. I can change/add private stuff in it, build and compile, and it works fine but when I try to add something public I get lost. Can someone tell me, if I want to add a public function in lbph_faces.cpp, what do I have to do? Which headerfiles do I have to update? Example: lbph_faces.cpp class LBPH : public LBPHFaceRecognizer { public: void test(); }; void LBPH::test() { std::cout

AttributeError: 'module' object has no attribute 'face' OS X

0
0
I'm trying to build opencv with opencv_contrib on OS X. I will explain step-by-step what I did: 1. I downloaded the OpenCV 3.1 from: http://opencv.org/downloads.html 2. I also downloaded the **opencv_contrib** from: https://github.com/Itseez/opencv_contrib 3. I put the **opencv_contrib** folder inside the opencv-3.1.0 folder 4. I created a folder called "**build**" inside the opencv-3.1.0 folder 5. From the terminal I went to the build folder: `/Users/kelvinsp/Downloads/opencv-3.1.0/build/` 6. Then I ran the following commands: `cmake -DOPENCV_EXTRA_MODULES_PATH=/Users/kelvinsp/Downloads/opencv-3.1.0/opencv_contrib/modules /Users/kelvinsp/Downloads/opencv-3.1.0/` `make -j5` `sudo make install` 7. Then, in the python terminal I tried to run the command: `import cv2` and receive the following error: `ImportError: No module named cv2` 8. Searching in stackoverflow, I found a solution and I ran the command: `export PYTHONPATH=/usr/local/lib/python2.7/site-packages/:$PYTHONPATH` 9. Now the import cv2 command is working, but when I ran the command `help(cv2.face)` I got the following error: `AttributeError: 'module' object has no attribute 'face'` Can someone help me please? I don't know what I'm doing wrong. ---------- cmake output: -- The CXX compiler identification is AppleClang 7.3.0.7030031 -- The C compiler identification is AppleClang 7.3.0.7030031 -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Performing Test HAVE_CXX_FSIGNED_CHAR -- Performing Test HAVE_CXX_FSIGNED_CHAR - Success -- Performing Test HAVE_C_FSIGNED_CHAR -- Performing Test HAVE_C_FSIGNED_CHAR - Success -- Performing Test HAVE_CXX_W -- Performing Test HAVE_CXX_W - Success -- Performing Test HAVE_C_W -- Performing Test HAVE_C_W - Success -- Performing Test HAVE_CXX_WALL -- Performing Test HAVE_CXX_WALL - Failed -- Performing Test HAVE_C_WALL -- Performing Test HAVE_C_WALL - Failed -- Performing Test HAVE_CXX_WERROR_RETURN_TYPE -- Performing Test HAVE_CXX_WERROR_RETURN_TYPE - Success -- Performing Test HAVE_C_WERROR_RETURN_TYPE -- Performing Test HAVE_C_WERROR_RETURN_TYPE - Success -- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR -- Performing Test HAVE_CXX_WERROR_NON_VIRTUAL_DTOR - Success -- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR -- Performing Test HAVE_C_WERROR_NON_VIRTUAL_DTOR - Success -- Performing Test HAVE_CXX_WERROR_ADDRESS -- Performing Test HAVE_CXX_WERROR_ADDRESS - Success -- Performing Test HAVE_C_WERROR_ADDRESS -- Performing Test HAVE_C_WERROR_ADDRESS - Success -- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT -- Performing Test HAVE_CXX_WERROR_SEQUENCE_POINT - Success -- Performing Test HAVE_C_WERROR_SEQUENCE_POINT -- Performing Test HAVE_C_WERROR_SEQUENCE_POINT - Success -- Performing Test HAVE_CXX_WFORMAT -- Performing Test HAVE_CXX_WFORMAT - Success -- Performing Test HAVE_C_WFORMAT -- Performing Test HAVE_C_WFORMAT - Success -- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY -- Performing Test HAVE_CXX_WERROR_FORMAT_SECURITY - Success -- Performing Test HAVE_C_WERROR_FORMAT_SECURITY -- Performing Test HAVE_C_WERROR_FORMAT_SECURITY - Success -- Performing Test HAVE_CXX_WMISSING_DECLARATIONS -- Performing Test HAVE_CXX_WMISSING_DECLARATIONS - Success -- Performing Test HAVE_C_WMISSING_DECLARATIONS -- Performing Test HAVE_C_WMISSING_DECLARATIONS - Success -- Performing Test HAVE_CXX_WMISSING_PROTOTYPES -- Performing Test HAVE_CXX_WMISSING_PROTOTYPES - Success -- Performing Test HAVE_C_WMISSING_PROTOTYPES -- Performing Test HAVE_C_WMISSING_PROTOTYPES - Success -- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES -- Performing Test HAVE_CXX_WSTRICT_PROTOTYPES - Success -- Performing Test HAVE_C_WSTRICT_PROTOTYPES -- Performing Test HAVE_C_WSTRICT_PROTOTYPES - Success -- Performing Test HAVE_CXX_WUNDEF -- Performing Test HAVE_CXX_WUNDEF - Success -- Performing Test HAVE_C_WUNDEF -- Performing Test HAVE_C_WUNDEF - Success -- Performing Test HAVE_CXX_WINIT_SELF -- Performing Test HAVE_CXX_WINIT_SELF - Success -- Performing Test HAVE_C_WINIT_SELF -- Performing Test HAVE_C_WINIT_SELF - Success -- Performing Test HAVE_CXX_WPOINTER_ARITH -- Performing Test HAVE_CXX_WPOINTER_ARITH - Success -- Performing Test HAVE_C_WPOINTER_ARITH -- Performing Test HAVE_C_WPOINTER_ARITH - Success -- Performing Test HAVE_CXX_WSHADOW -- Performing Test HAVE_CXX_WSHADOW - Success -- Performing Test HAVE_C_WSHADOW -- Performing Test HAVE_C_WSHADOW - Success -- Performing Test HAVE_CXX_WSIGN_PROMO -- Performing Test HAVE_CXX_WSIGN_PROMO - Success -- Performing Test HAVE_C_WSIGN_PROMO -- Performing Test HAVE_C_WSIGN_PROMO - Success -- Performing Test HAVE_CXX_WNO_NARROWING -- Performing Test HAVE_CXX_WNO_NARROWING - Success -- Performing Test HAVE_C_WNO_NARROWING -- Performing Test HAVE_C_WNO_NARROWING - Success -- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR -- Performing Test HAVE_CXX_WNO_DELETE_NON_VIRTUAL_DTOR - Success -- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR -- Performing Test HAVE_C_WNO_DELETE_NON_VIRTUAL_DTOR - Success -- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS -- Performing Test HAVE_CXX_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Success -- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS -- Performing Test HAVE_C_WNO_UNNAMED_TYPE_TEMPLATE_ARGS - Success -- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION -- Performing Test HAVE_CXX_FDIAGNOSTICS_SHOW_OPTION - Success -- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION -- Performing Test HAVE_C_FDIAGNOSTICS_SHOW_OPTION - Success -- Performing Test HAVE_CXX_WNO_LONG_LONG -- Performing Test HAVE_CXX_WNO_LONG_LONG - Success -- Performing Test HAVE_C_WNO_LONG_LONG -- Performing Test HAVE_C_WNO_LONG_LONG - Success -- Performing Test HAVE_CXX_QUNUSED_ARGUMENTS -- Performing Test HAVE_CXX_QUNUSED_ARGUMENTS - Success -- Performing Test HAVE_C_QUNUSED_ARGUMENTS -- Performing Test HAVE_C_QUNUSED_ARGUMENTS - Success -- Performing Test HAVE_CXX_WNO_SEMICOLON_BEFORE_METHOD_BODY -- Performing Test HAVE_CXX_WNO_SEMICOLON_BEFORE_METHOD_BODY - Success -- Performing Test HAVE_C_WNO_SEMICOLON_BEFORE_METHOD_BODY -- Performing Test HAVE_C_WNO_SEMICOLON_BEFORE_METHOD_BODY - Success -- Performing Test HAVE_CXX_FNO_OMIT_FRAME_POINTER -- Performing Test HAVE_CXX_FNO_OMIT_FRAME_POINTER - Success -- Performing Test HAVE_C_FNO_OMIT_FRAME_POINTER -- Performing Test HAVE_C_FNO_OMIT_FRAME_POINTER - Success -- Performing Test HAVE_CXX_MSSE -- Performing Test HAVE_CXX_MSSE - Success -- Performing Test HAVE_C_MSSE -- Performing Test HAVE_C_MSSE - Success -- Performing Test HAVE_CXX_MSSE2 -- Performing Test HAVE_CXX_MSSE2 - Success -- Performing Test HAVE_C_MSSE2 -- Performing Test HAVE_C_MSSE2 - Success -- Performing Test HAVE_CXX_MNO_AVX -- Performing Test HAVE_CXX_MNO_AVX - Success -- Performing Test HAVE_C_MNO_AVX -- Performing Test HAVE_C_MNO_AVX - Success -- Performing Test HAVE_CXX_MSSE3 -- Performing Test HAVE_CXX_MSSE3 - Success -- Performing Test HAVE_C_MSSE3 -- Performing Test HAVE_C_MSSE3 - Success -- Performing Test HAVE_CXX_MNO_SSSE3 -- Performing Test HAVE_CXX_MNO_SSSE3 - Success -- Performing Test HAVE_C_MNO_SSSE3 -- Performing Test HAVE_C_MNO_SSSE3 - Success -- Performing Test HAVE_CXX_MNO_SSE4_1 -- Performing Test HAVE_CXX_MNO_SSE4_1 - Success -- Performing Test HAVE_C_MNO_SSE4_1 -- Performing Test HAVE_C_MNO_SSE4_1 - Success -- Performing Test HAVE_CXX_MNO_SSE4_2 -- Performing Test HAVE_CXX_MNO_SSE4_2 - Success -- Performing Test HAVE_C_MNO_SSE4_2 -- Performing Test HAVE_C_MNO_SSE4_2 - Success -- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN -- Performing Test HAVE_CXX_FVISIBILITY_HIDDEN - Success -- Performing Test HAVE_C_FVISIBILITY_HIDDEN -- Performing Test HAVE_C_FVISIBILITY_HIDDEN - Success -- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN -- Performing Test HAVE_CXX_FVISIBILITY_INLINES_HIDDEN - Success -- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN -- Performing Test HAVE_C_FVISIBILITY_INLINES_HIDDEN - Success -- Check if the system is big endian -- Searching 16 bit integer -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of unsigned short -- Check size of unsigned short - done -- Using unsigned short -- Check if the system is big endian - little endian -- Looking for fseeko -- Looking for fseeko - found -- Looking for unistd.h -- Looking for unistd.h - found -- Check size of off64_t -- Check size of off64_t - failed -- Performing Test HAVE_C_WNO_SHORTEN_64_TO_32 -- Performing Test HAVE_C_WNO_SHORTEN_64_TO_32 - Success -- Performing Test HAVE_C_WNO_ATTRIBUTES -- Performing Test HAVE_C_WNO_ATTRIBUTES - Success -- Performing Test HAVE_C_WNO_STRICT_PROTOTYPES -- Performing Test HAVE_C_WNO_STRICT_PROTOTYPES - Success -- Performing Test HAVE_C_WNO_MISSING_PROTOTYPES -- Performing Test HAVE_C_WNO_MISSING_PROTOTYPES - Success -- Performing Test HAVE_C_WNO_MISSING_DECLARATIONS -- Performing Test HAVE_C_WNO_MISSING_DECLARATIONS - Success -- Looking for assert.h -- Looking for assert.h - found -- Looking for fcntl.h -- Looking for fcntl.h - found -- Looking for io.h -- Looking for io.h - not found -- Looking for jbg_newlen -- Looking for jbg_newlen - not found -- Looking for mmap -- Looking for mmap - found -- Looking for search.h -- Looking for search.h - found -- Looking for string.h -- Looking for string.h - found -- Looking for unistd.h -- Looking for unistd.h - found -- Performing Test HAVE_C_WNO_UNUSED_BUT_SET_VARIABLE -- Performing Test HAVE_C_WNO_UNUSED_BUT_SET_VARIABLE - Failed -- Performing Test HAVE_C_WNO_UNDEF -- Performing Test HAVE_C_WNO_UNDEF - Success -- Performing Test HAVE_C_WNO_UNUSED -- Performing Test HAVE_C_WNO_UNUSED - Success -- Performing Test HAVE_C_WNO_SIGN_COMPARE -- Performing Test HAVE_C_WNO_SIGN_COMPARE - Success -- Performing Test HAVE_C_WNO_CAST_ALIGN -- Performing Test HAVE_C_WNO_CAST_ALIGN - Success -- Performing Test HAVE_C_WNO_SHADOW -- Performing Test HAVE_C_WNO_SHADOW - Success -- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED -- Performing Test HAVE_C_WNO_MAYBE_UNINITIALIZED - Failed -- Performing Test HAVE_C_WNO_POINTER_TO_INT_CAST -- Performing Test HAVE_C_WNO_POINTER_TO_INT_CAST - Success -- Performing Test HAVE_C_WNO_INT_TO_POINTER_CAST -- Performing Test HAVE_C_WNO_INT_TO_POINTER_CAST - Success -- Performing Test HAVE_C_WNO_UNUSED_PARAMETER -- Performing Test HAVE_C_WNO_UNUSED_PARAMETER - Success -- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS -- Performing Test HAVE_CXX_WNO_MISSING_DECLARATIONS - Success -- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER -- Performing Test HAVE_CXX_WNO_UNUSED_PARAMETER - Success -- Performing Test HAVE_C_WNO_UNUSED_VARIABLE -- Performing Test HAVE_C_WNO_UNUSED_VARIABLE - Success -- Performing Test HAVE_C_WNO_UNUSED_FUNCTION -- Performing Test HAVE_C_WNO_UNUSED_FUNCTION - Success -- Performing Test HAVE_C_WNO_IMPLICIT_FUNCTION_DECLARATION -- Performing Test HAVE_C_WNO_IMPLICIT_FUNCTION_DECLARATION - Success -- Performing Test HAVE_C_WNO_UNINITIALIZED -- Performing Test HAVE_C_WNO_UNINITIALIZED - Success -- Performing Test HAVE_C_WNO_UNUSED_BUT_SET_PARAMETER -- Performing Test HAVE_C_WNO_UNUSED_BUT_SET_PARAMETER - Failed -- Performing Test HAVE_C_WNO_STRICT_OVERFLOW -- Performing Test HAVE_C_WNO_STRICT_OVERFLOW - Success -- Looking for semaphore.h -- Looking for semaphore.h - found -- Performing Test HAVE_CXX_WNO_SHADOW -- Performing Test HAVE_CXX_WNO_SHADOW - Success -- Performing Test HAVE_CXX_WNO_UNUSED -- Performing Test HAVE_CXX_WNO_UNUSED - Success -- Performing Test HAVE_CXX_WNO_SIGN_COMPARE -- Performing Test HAVE_CXX_WNO_SIGN_COMPARE - Success -- Performing Test HAVE_CXX_WNO_UNDEF -- Performing Test HAVE_CXX_WNO_UNDEF - Success -- Performing Test HAVE_CXX_WNO_UNINITIALIZED -- Performing Test HAVE_CXX_WNO_UNINITIALIZED - Success -- Performing Test HAVE_CXX_WNO_SWITCH -- Performing Test HAVE_CXX_WNO_SWITCH - Success -- Performing Test HAVE_CXX_WNO_PARENTHESES -- Performing Test HAVE_CXX_WNO_PARENTHESES - Success -- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS -- Performing Test HAVE_CXX_WNO_ARRAY_BOUNDS - Success -- Performing Test HAVE_CXX_WNO_EXTRA -- Performing Test HAVE_CXX_WNO_EXTRA - Success -- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS -- Performing Test HAVE_CXX_WNO_DEPRECATED_DECLARATIONS - Success -- Checking for module 'gstreamer-base-1.0' -- No package 'gstreamer-base-1.0' found -- Checking for module 'gstreamer-video-1.0' -- No package 'gstreamer-video-1.0' found -- Checking for module 'gstreamer-app-1.0' -- No package 'gstreamer-app-1.0' found -- Checking for module 'gstreamer-riff-1.0' -- No package 'gstreamer-riff-1.0' found -- Checking for module 'gstreamer-pbutils-1.0' -- No package 'gstreamer-pbutils-1.0' found -- Checking for module 'gstreamer-base-0.10' -- No package 'gstreamer-base-0.10' found -- Checking for module 'gstreamer-video-0.10' -- No package 'gstreamer-video-0.10' found -- Checking for module 'gstreamer-app-0.10' -- No package 'gstreamer-app-0.10' found -- Checking for module 'gstreamer-riff-0.10' -- No package 'gstreamer-riff-0.10' found -- Checking for module 'gstreamer-pbutils-0.10' -- No package 'gstreamer-pbutils-0.10' found -- Checking for module 'libdc1394-2' -- No package 'libdc1394-2' found -- Checking for module 'libdc1394' -- No package 'libdc1394' found -- Checking for module 'libv4l1' -- No package 'libv4l1' found -- Checking for module 'libv4l2' -- No package 'libv4l2' found -- Looking for linux/videodev.h -- Looking for linux/videodev.h - not found -- Looking for linux/videodev2.h -- Looking for linux/videodev2.h - not found -- Looking for sys/videoio.h -- Looking for sys/videoio.h - not found -- Checking for module 'libavcodec' -- No package 'libavcodec' found -- Checking for module 'libavformat' -- No package 'libavformat' found -- Checking for module 'libavutil' -- No package 'libavutil' found -- Checking for module 'libswscale' -- No package 'libswscale' found -- Checking for module 'libavresample' -- No package 'libavresample' found -- Looking for libavformat/avformat.h -- Looking for libavformat/avformat.h - not found -- Looking for ffmpeg/avformat.h -- Looking for ffmpeg/avformat.h - not found -- Checking for module 'libgphoto2' -- No package 'libgphoto2' found -- ICV: Downloading ippicv_macosx_20151201.tgz... -- ICV: Unpacking ippicv_macosx_20151201.tgz to /Users/kelvinsp/Downloads/opencv-3.1.0/3rdparty/ippicv/unpack... -- ICV: Package successfully downloaded -- found IPP (ICV version): 9.0.1 [9.0.1] -- at: /Users/kelvinsp/Downloads/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_osx -- Found Doxygen: /usr/local/bin/doxygen (found version "1.8.11") -- To enable PlantUML support, set PLANTUML_JAR environment variable or pass -DPLANTUML_JAR= option to cmake -- Found PythonInterp: /opt/local/bin/python2.7 (found suitable version "2.7.11", minimum required is "2.7") -- Could NOT find PythonLibs: Found unsuitable version "2.7.10", but required is exact version "2.7.11" (found /usr/lib/libpython2.7.dylib) Traceback (most recent call last): File "", line 1, in ImportError: No module named numpy.distutils -- Could NOT find PythonInterp: Found unsuitable version "2.7.10", but required is at least "3.4" (found /usr/bin/python) -- Could NOT find PythonInterp: Found unsuitable version "2.7.10", but required is at least "3.2" (found /usr/bin/python) Unable to find any JVMs matching version "(null)". No Java runtime present, try --request to install. -- Found JNI: /System/Library/Frameworks/JavaVM.framework -- Could NOT find Matlab (missing: MATLAB_MEX_SCRIPT MATLAB_INCLUDE_DIRS MATLAB_ROOT_DIR MATLAB_LIBRARIES MATLAB_LIBRARY_DIRS MATLAB_MEXEXT MATLAB_ARCH MATLAB_BIN) -- VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file -- Caffe: NO -- Protobuf: NO -- Glog: NO -- Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS) -- Checking SFM deps... FALSE -- Module opencv_sfm disabled because the following dependencies are not found: Eigen Glog/Gflags -- Assume that non-module dependency is available: -framework OpenCL (for module opencv_core) -- Performing Test HAVE_CXX_WNO_MAYBE_UNINITIALIZED -- Performing Test HAVE_CXX_WNO_MAYBE_UNINITIALIZED - Failed -- Performing Test HAVE_CXX_WNO_SIGN_PROMO -- Performing Test HAVE_CXX_WNO_SIGN_PROMO - Success -- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES -- Performing Test HAVE_CXX_WNO_MISSING_PROTOTYPES - Success -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - found -- Found Threads: TRUE -- Could NOT find Protobuf (missing: PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR) -- Build libprotobuf from sources: -- libprotobuf not found into system -- The protocol buffer compiler not found -- Looking for include file pthread.h -- Looking for include file pthread.h - found -- Looking for C++ include unordered_map -- Looking for C++ include unordered_map - found -- Looking for C++ include tr1/unordered_map -- Looking for C++ include tr1/unordered_map - not found -- Looking for C++ include unordered_set -- Looking for C++ include unordered_set - found -- Looking for C++ include tr1/unordered_set -- Looking for C++ include tr1/unordered_set - not found -- Performing Test HAVE_CXX_WNO_DEPRECATED -- Performing Test HAVE_CXX_WNO_DEPRECATED - Success -- Performing Test HAVE_CXX_WNO_UNUSED_LOCAL_TYPEDEFS -- Performing Test HAVE_CXX_WNO_UNUSED_LOCAL_TYPEDEFS - Success -- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE -- Performing Test HAVE_CXX_WNO_TAUTOLOGICAL_UNDEFINED_COMPARE - Success -- Performing Test HAVE_OBJCXX_FOBJC_EXCEPTIONS -- Performing Test HAVE_OBJCXX_FOBJC_EXCEPTIONS - Success -- Tesseract: NO -- -- General configuration for OpenCV 3.1.0 ===================================== -- Version control: unknown -- -- Platform: -- Host: Darwin 15.5.0 x86_64 -- CMake: 3.5.2 -- CMake generator: Unix Makefiles -- CMake build tool: /usr/bin/make -- Configuration: Release -- -- C/C++: -- Built as dynamic libs?: YES -- C++ Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ (ver 7.3.0.7030031) -- C++ flags (Release): -fsigned-char -W -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -- C++ flags (Debug): -fsigned-char -W -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG -- C Compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- C flags (Release): -fsigned-char -W -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG -- C flags (Debug): -fsigned-char -W -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point -Wformat -Werror=format-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wno-narrowing -Wno-delete-non-virtual-dtor -Wno-unnamed-type-template-args -fdiagnostics-show-option -Wno-long-long -Qunused-arguments -Wno-semicolon-before-method-body -fno-omit-frame-pointer -msse -msse2 -mno-avx -msse3 -mno-ssse3 -mno-sse4.1 -mno-sse4.2 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG -- Linker flags (Release): -- Linker flags (Debug): -- Precompiled headers: NO -- Extra dependencies: -framework OpenCL -framework Cocoa -framework QTKit -framework QuartzCore -framework AppKit -- 3rdparty dependencies: libjpeg libwebp libpng libtiff libjasper IlmImf zlib libprotobuf -- -- OpenCV modules: -- To be built: core flann imgproc ml photo reg surface_matching video dnn fuzzy imgcodecs shape videoio highgui objdetect plot superres ts xobjdetect xphoto bgsegm bioinspired dpm face features2d line_descriptor saliency text calib3d ccalib datasets rgbd stereo structured_light tracking videostab xfeatures2d ximgproc aruco optflow stitching -- Disabled: world contrib_world -- Disabled by dependency: - -- Unavailable: cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev java python2 python3 viz cvv hdf matlab sfm -- -- GUI: -- QT: NO -- Cocoa: YES -- OpenGL support: NO -- VTK support: NO -- -- Media I/O: -- ZLib: build (ver 1.2.8) -- JPEG: build (ver 90) -- WEBP: build (ver 0.3.1) -- PNG: build (ver 1.6.19) -- TIFF: build (ver 42 - 4.0.2) -- JPEG 2000: build (ver 1.900.1) -- OpenEXR: build (ver 1.7.1) -- GDAL: NO -- -- Video I/O: -- DC1394 1.x: NO -- DC1394 2.x: NO -- FFMPEG: NO -- codec: NO -- format: NO -- util: NO -- swscale: NO -- resample: NO -- gentoo-style: NO -- GStreamer: NO -- OpenNI: NO -- OpenNI PrimeSensor Modules: NO -- OpenNI2: NO -- PvAPI: NO -- GigEVisionSDK: NO -- QuickTime: NO -- QTKit: YES -- V4L/V4L2: NO/NO -- XIMEA: NO -- gPhoto2: NO -- -- Parallel framework: GCD -- -- Other third-party libraries: -- Use IPP: 9.0.1 [9.0.1] -- at: /Users/kelvinsp/Downloads/opencv-3.1.0/3rdparty/ippicv/unpack/ippicv_osx -- Use IPP Async: NO -- Use VA: NO -- Use Intel VA-API/OpenCL: NO -- Use Eigen: NO -- Use Cuda: NO -- Use OpenCL: YES -- Use custom HAL: NO -- -- OpenCL: -- Version: static -- libraries: -framework OpenCL -- Use AMDFFT: NO -- Use AMDBLAS: NO -- -- Python 2: -- Interpreter: /opt/local/bin/python2.7 (ver 2.7.11) -- -- Python 3: -- Interpreter: NO -- -- Python (for build): /opt/local/bin/python2.7 -- -- Java: -- ant: NO -- JNI: /System/Library/Frameworks/JavaVM.framework/Headers /System/Library/Frameworks/JavaVM.framework/Headers /System/Library/Frameworks/JavaVM.framework/Headers -- Java wrappers: NO -- Java tests: NO -- -- Matlab: Matlab not found or implicitly disabled -- -- Documentation: -- Doxygen: /usr/local/bin/doxygen (ver 1.8.11) -- PlantUML: NO -- -- Tests and samples: -- Tests: YES -- Performance tests: YES -- C/C++ Examples: NO -- -- Install path: /usr/local -- -- cvconfig.h is in: /Users/kelvinsp/Downloads/opencv-3.1.0/build -- ----------------------------------------------------------------- -- -- Configuring done -- Generating done -- Build files have been written to: /Users/kelvinsp/Downloads/opencv-3.1.0/build

QT 'emit': undeclared identifier error after included

0
0
I'm using OpenCV with QT and trying to implement facial recognition but as soon as I include `` from the "contrib" branch, QT complains about `error: C2065: 'emit': undeclared identifier`. I've tried including `"qobjectdefs.h"` and `#define emit` at the top of the appropriate header file, but it does not work. Code: **Header** #ifndef FACEDETECTOR_H #define FACEDETECTOR_H #include #include #include #include #include #include #include #include #include //This causes the error as soon as I uncomment it #include #include class FaceDetector : public QObject { Q_OBJECT public: FaceDetector(QObject *parent=0) : QObject(parent), processAll_(true) {} void setProcessAll(bool all); ~FaceDetector(); signals: void image_signal(const QImage&); public slots: void processFrame(const cv::Mat& frame); void facecascade_filename(QString filename); private: QString facecascade_filename_; QString eyecascade_filename_; QBasicTimer timer_; QVector<:mat> m_CSVimages; QVector m_CSVlabels; cv::Mat frame_; bool processAll_; cv::CascadeClassifier faceCascade; cv::CascadeClassifier eyeCascade; //I need face.hpp for this: //cv::Ptr<:face::facerecognizer> m_faceModel; void process(cv::Mat frame); void loadFiles(const cv::String& faceCascadeFilename, const cv::String& eyesCascadeFilename); static void loadCSV(const cv::String& filePath, QVector<:mat>& images, QVector& labels, char separator = ';'); void queue(const cv::Mat & frame); void timerEvent(QTimerEvent* ev); static void matDeleter(void* mat); }; #endif // FACEDETECTOR_H **Implementation** Other functions omitted for brevity #include "faceDetector.h" void FaceDetector::process(cv::Mat frame) { cv::Mat grey_image; cv::cvtColor(frame, grey_image, CV_BGR2GRAY); cv::equalizeHist(grey_image, grey_image); std::vector<:rect> faces; // Calculate the camera size and set the size to 1/8 of screen height faceCascade.detectMultiScale(grey_image, faces, 1.1, 8, 0|CV_HAAR_SCALE_IMAGE, cv::Size(frame.cols/4, frame.rows/4)); // Minimum size of obj //-- Draw rectangles around faces for( size_t i = 0; i (frame.data), frame.cols, frame.rows, frame.step, QImage::Format_RGB888, &matDeleter, new cv::Mat(frame)); image.rgbSwapped(); Q_ASSERT(image.constBits() == frame.data); //This is the error location emit image_signal(image); }

What is the difference between Stump-based and Tree-based frontal face detector?

0
0
In the Opencv there are some haar cascades: - haarcascade_frontalface_alt.xml - Stump-based 20x20 gentle adaboost frontal face detector. Created by Rainer Lienhart. - haarcascade_frontalface_alt2.xml - Tree-based 20x20 gentle adaboost frontal face detector. Created by Rainer Lienhart. What is the difference between Stump-based and Tree-based frontal face detector? Inipractice, they give very similar results.

Face Detection Error OpenCV 3.1.0

0
0
I am trying to get started in opneCv and get learning but am running into problems in regards to face detection the code I have should detect faces I believe my linkages are fine can someone please help me understand what I'm doing wrong? full code in both main.cpp and project.pro file is provided below **App Output:** *starting /Users/admin/Desktop/build-Origin-Desktop_Qt_5_6_0_clang_64bit-Debug/Origin.app/Contents/MacOS/Origin... OpenCV Error: Assertion failed (!empty()) in detectMultiScale, file /Users/admin/Desktop/opencv-3.1.0/modules/objdetect/src/cascadedetect.cpp, line 1639 Cleaned up camera. Unable to initiate camera /Users/admin/Desktop/build-Origin-Desktop_Qt_5_6_0_clang_64bit-Debug/Origin.app/Contents/MacOS/Origin exited with code 0* **Compile Output:** *10:46:41: Running steps for project Origin... 10:46:41: Configuration unchanged, skipping qmake step. 10:46:41: Starting: "/usr/bin/make" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -c -pipe -stdlib=libc++ -g -std=gnu++11 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.7 -Wall -W -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../Origin -I. -I/usr/local/include -I../../Qt/5.6/clang_64/lib/QtWidgets.framework/Headers -I../../Qt/5.6/clang_64/lib/QtGui.framework/Headers -I../../Qt/5.6/clang_64/lib/QtCore.framework/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/OpenGL.framework/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I../../Qt/5.6/clang_64/mkspecs/macx-clang -F/Users/admin/Qt/5.6/clang_64/lib -o main.o ../Origin/main.cpp /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -headerpad_max_install_names -stdlib=libc++ -Wl,-syslibroot,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk -mmacosx-version-min=10.7 -Wl,-rpath,/Users/travishaycock/Qt/5.6/clang_64/lib -o Origin.app/Contents/MacOS/Origin main.o mainwindow.o moc_mainwindow.o -F/Users/admin/Qt/5.6/clang_64/lib -L/usr/local/lib -lopencv_core -lopencv_highgui -lopencv_videoio -lopencv_imgproc -lopencv_objdetect -framework QtWidgets -framework QtGui -framework QtCore -framework OpenGL -framework AGL 10:46:43: The process "/usr/bin/make" exited normally. 10:46:43: Elapsed time: 00:02.* **Main.cpp File** #include "mainwindow.h" #include #include #include #include #include #include #include #include #include #include using namespace cv; using namespace std; CascadeClassifier face_cascade, eyes_cascade; String window_name = "Face Detection"; /** * Detects faces */ void detectFaces(Mat frame) { std::vector faces; Mat frame_gray; cvtColor(frame, frame_gray, COLOR_BGR2GRAY); // Convert to gray scale equalizeHist(frame_gray, frame_gray); // Equalize histogram // Detect faces face_cascade.detectMultiScale(frame_gray, faces, 1.1, 3, 0|CASCADE_SCALE_IMAGE, Size(30, 30)); // Iterate over all of the faces for(size_t i = 0; i eyes; // Try to detect eyes, inside each face eyes_cascade.detectMultiScale(face, eyes, 1.1, 2, 0 |CASCADE_SCALE_IMAGE, Size(30, 30) ); // Check to see if eyes inside of face, if so, draw ellipse around face if(eyes.size() > 0) ellipse(frame, center, Size(faces[i].width/2, faces[i].height/2), 0, 0, 360, Scalar( 255, 0, 255 ), 4, 8, 0 ); } imshow( window_name, frame ); } int main(int argc, char *argv[]){ QApplication a(argc, argv); MainWindow w; // cam code try{ VideoCapture cap(0); // Open default camera Mat frame; // Load preconstructed classifier face_cascade.load("haarcascade_frontalface_alt.xml"); while(cap.read(frame)) { detectFaces(frame); // Call function to detect faces if( waitKey(30) >= 0) // Pause key break; } return 0; }catch(Exception ex){ std::cout

OpenCV Contrib Face module with Java wrapper - returning multiple predictions

0
0
I'm using [OpenCV Contrib Face module](https://github.com/Itseez/opencv_contrib/tree/master/modules/face) in Java. Java wrapper is automatically generated from C++ source code based on [`CV_WRAP`](http://answers.opencv.org/question/6528/cv_wrap-and-cv_exports_w/) tag. So far so good, **but** unfortunately not all methods I need have wrappers. :-( I'm using `FaceRecognizer.predict` method which returns label of face that is most similar (in terms of [eigenfaces](https://en.wikipedia.org/wiki/Eigenface)) to given face. What I desperately need is to get `N>1` (for example `N=5`) best matches, ie. `N` images with minimal [`PredictResult.distance`](https://github.com/Itseez/opencv_contrib/blob/master/modules/face/include/opencv2/face/predict_collector.hpp#L88). This is automatically generated Java's wrapper for `predict` method: // // C++: void predict(Mat src, int& label, double& confidence) // //javadoc: FaceRecognizer::predict(src, label, confidence) public void predict(Mat src, int[] label, double[] confidence) { double[] label_out = new double[1]; double[] confidence_out = new double[1]; predict_1(nativeObj, src.nativeObj, label_out, confidence_out); if(label!=null) label[0] = (int)label_out[0]; if(confidence!=null) confidence[0] = (double)confidence_out[0]; return; } As you can see, it uses two arrays (`label_out` and `confidence_out`) of length equal `1`. I need more generalized version which is available in C++ source code as a [`StandardCollector::getResults`](https://github.com/Itseez/opencv_contrib/blob/master/modules/face/src/predict_collector.cpp#L87) method. Is there an easy way to add a few [`CV_WRAP`](http://answers.opencv.org/question/6528/cv_wrap-and-cv_exports_w/) *'here and there'* to get multiple predictions using Java wrapper for: std::vector> StandardCollector::getResults(bool sorted) const { std::vector> res(data.size()); std::transform(data.begin(), data.end(), res.begin(), &toPair); if (sorted) { std::sort(res.begin(), res.end(), &pairLess); } return res; } ? Thanks in advance!

Face Detection example how to run in android 64 bits

0
0
RHi, I runned face detection example in a android 32 bits without problem, but i want to run it in a android 64 bits, but show error at loading opencv library, is there a way? thnks. Regards, Juan

Improving face recognition accuracy

0
0
I'm working on a Face Recognition program using `Opencv 3.1` with `Python 3` on `Linux` and I'm trying to increase recognition accuracy as much as I can. **My issue:** The confidence values between *Person A* (myself) and *Person B* (a friend) are a bit too close. There is a "fair" amount of difference, but not enough to set a threshold without getting false positives/negatives. I wrote a script to recognize *Person A* over a set of images for *Person B* and calculate the average confidence so I could see how much they differ by, and I noticed that as the face size in Step 3 of Preprocessing (see below) **increased**, the difference **decreased**. My expectation was that by **increasing** the face size, there would be more detail and thus the difference would **increase**. Detected face sizes in this case were roughly `1500x1500`. **My question:** How can I improve face recognition accuracy? Below is some information about my project. Thanks. ---------- Files used: - OpenCV's Haar Cascade (`haarcascade_frontalface_default.xml`) with a `scaleFactor` of `1.1` and `minNeighbors` of `10` for detecting faces. - Local Binary Patterns Histograms algorithm (`createLBPHFaceRecognizer`) for recognizing faces. ---------- Image information: - Each `4928x3264` - Same lighting conditions - Different facial expressions - Different angles (heads tilting / facing different directions) ---------- Preprocessing Steps: 1. Cropping the face out of the whole image 2. Converting it to grayscale 3. Resizing it to a "standard" size 4. Histogram Equalization to smooth out lighting differences 5. Applying a Bilateral Filter to smooth out small details ---------- Training Steps: 1. Preprocess raw images for a given person 2. Train recognizer using preprocessed faces 3. Save trained recognizer model to a file ---------- Recognition Steps: 1. Load recognizer model from file 2. Take in image from either file or webcam 3. Detect face 4. Preprocess face (see above) 5. Attempt recognition

Help: Face Recognition using LBP confused with unknown Faces

0
0
Hello everyone, I try to use this face recognition code below which I found on one of the Opencv documentation, but I have a problem when a new person face who is not in the recognition database is compared, the program confused saying this face is Mr.X or Mr.y or Mr.z who are already in the database. It works fine if face of the person to be compared is already in the face recognition database. Please people, your help will kindly be appreciated. #include "opencv2/core/core.hpp" #include "opencv2/contrib/contrib.hpp" #include "opencv2/highgui/highgui.hpp" #include #include #include using namespace cv; using namespace std; static void read_csv(const string& filename, vector& images, vector& labels, char separator = ';') { std::ifstream file(filename.c_str(), ifstream::in); if (!file) { string error_message = "No valid input file was given, please check the given filename."; CV_Error(CV_StsBadArg, error_message); } string line, path, classlabel; while (getline(file, line)) { stringstream liness(line); getline(liness, path, separator); getline(liness, classlabel); if(!path.empty() && !classlabel.empty()) { images.push_back(imread(path, 0)); labels.push_back(atoi(classlabel.c_str())); } } } int main(int argc, const char *argv[]) { // Check for valid command line arguments, print usage // if no arguments were given. if (argc != 2) { cout " images; vector labels; // Read in the data. This can fail if no valid // input filename is given. try { read_csv(fn_csv, images, labels); } catch (cv::Exception& e) { cerr model = createLBPHFaceRecognizer(); model->train(images, labels); // The following line predicts the label of a given // test image: int predictedLabel = model->predict(testSample); // // To get the confidence of a prediction call the model with: // // int predictedLabel = -1; // double confidence = 0.0; // model->predict(testSample, predictedLabel, confidence); // string result_message = format("Predicted class = %d / Actual class = %d.", predictedLabel, testLabel); cout set("threshold", 0.0); // Now the threshold of this model is set to 0.0. A prediction // now returns -1, as it's impossible to have a distance below // it predictedLabel = model->predict(testSample); cout getInt("radius"), model->getInt("neighbors"), model->getInt("grid_x"), model->getInt("grid_y"), model->getDouble("threshold")); cout histograms = model->getMatVector("histograms"); // But should I really visualize it? Probably the length is interesting: cout

Fastest way to track multiple faces?

0
0
Hi, everyone! I am doing a project that the program can detect faces in the video. And you know in detection, it could not always find a face during the whole process, so i want to use tracking to help me detect the face. The problem is even i use the KCF algorithm to track multiple faces, the time would be more and more depending on the number of the faces. Therefore, i'd like to know if there any other way to track multiple faces in a short time?

To distinguish a false face from the real face

0
0
Hello to everyone, I have a questition for face recognition How do I distinguish a real human face from a photo? Is something like this possible? This is really important for face verification. I developed an application, I can face recognition with this application, but as it is here, the people in the photo accept it in the hundreds. (https://youtu.be/0wxWdCc_TFo?t=14)

Face Recognition

0
0
i want to write a program which can compare a real time face with the saved photos in the database. Something like this but in Java: https://youtu.be/yFSPnu6_TZY

face.predict error in cv3 python 2.7

0
0
The following code works in cv2, but neither predict line works in cv3: recognizer = cv2.face.createLBPHFaceRecognizer(radius=2, neighbors=16, grid_x=3, grid_y=3) (prediction, conf) = recognizer.predict(testing.data[i]) #OR.. (prediction, conf) = cv2.face.predict(testing.data[i]) The attempt to call predict results in either : object is not iterable or object as no attribute 'predict' error I found some old discussion related to this Face class, https://github.com/peterbraden/node-opencv/pull/379/files https://github.com/opencv/opencv_contrib/issues/184 but not sure if it's still relevant or if it's even the same issue I have. I'm pretty new to this, so I think I'm just calling it the wrong way, especially since predict is listed in the cv3 documentation: http://docs.opencv.org/3.1.0/dd/d65/classcv_1_1face_1_1FaceRecognizer.html

Problem with knn

0
0
Hi there, Im using OpenCV 2.4.12 with Visual Studio 2012. I am trying to classify facial image based 3 age groups. i have extracted the features using PCA in image form. Below is my PCA code. I need help to classify the images using the features extracted using knn. #include "opencv2/contrib/contrib.hpp" #include "opencv2/core/core.hpp" #include "opencv2/highgui/highgui.hpp" #include #include #include using namespace cv; using namespace std; static Mat norm_0_255(InputArray _src) { Mat src = _src.getMat(); // Create and return normalized image: Mat dst; switch(src.channels()) { case 1: cv::normalize(_src, dst, 0, 255, NORM_MINMAX, CV_8UC1); break; case 3: cv::normalize(_src, dst, 0, 255, NORM_MINMAX, CV_8UC3); break; default: src.copyTo(dst); break; } return dst; } static void read_csv(const string& filename, vector& images, vector& labels, char separator = ';') { std::ifstream file(filename.c_str(), ifstream::in); if (!file) { string error_message = "No valid input file was given, please check the given filename."; CV_Error(CV_StsBadArg, error_message); } string line, path, classlabel; while (getline(file, line)) { stringstream liness(line); getline(liness, path, separator); getline(liness, classlabel); if(!path.empty() && !classlabel.empty()) { images.push_back(imread(path, 0)); labels.push_back(atoi(classlabel.c_str())); } } } int main(int argc, const char *argv[]) { // Check for valid command line arguments, print usage // if no arguments were given. if (argc " images; vector labels; // Read in the data. This can fail if no valid // input filename is given. try { read_csv(fn_csv, images, labels); } catch (cv::Exception& e) { cerr model0 = createEigenFaceRecognizer(); model0->train(images, labels); // save the model to eigenfaces_at.yaml model0->save("eigenfaces_at.yml"); // // // Now create a new Eigenfaces Recognizer // Ptr model1 = createEigenFaceRecognizer(); model1->load("eigenfaces_at.yml"); // The following line predicts the label of a given // test image: int predictedLabel = model1->predict(testSample); // // To get the confidence of a prediction call the model with: // // int predictedLabel = -1; // double confidence = 0.0; // model->predict(testSample, predictedLabel, confidence); // string result_message = format("Predicted class = %d / Actual class = %d.", predictedLabel, testLabel); cout getMat("eigenvalues"); // And we can do the same to display the Eigenvectors (read Eigenfaces): Mat W = model1->getMat("eigenvectors"); // Get the sample mean from the training data Mat mean = model1->getMat("mean"); // Display or save: if(argc == 2) { imshow("mean", norm_0_255(mean.reshape(1, images[0].rows))); } else { imwrite(format("%s/mean.png", output_folder.c_str()), norm_0_255(mean.reshape(1, images[0].rows))); } // Display or save the Eigenfaces: for (int i = 0; i (i)); cout

How I can extract a face features as vector

0
0
Hello! I use OpenCV with Python to detect faces in images (with Haar cascade detector). Everything work fine, but I have a question. How I can extract a face features and put them into vector or array? For example - I detect a face, get coordinates of the face in the image, extract the face, normalize it and then I want to extract the features that differs from face to face. For me doesn't matter what is exactly meaning of the integers from feature vector, I only want to be different between two faces. How I can done this? Any suggestions? BR, Alex

Which face landmarks do the 68 points of dlib correspond to?

0
0
Which face landmarks do the 68 points of dlib correspond to? I've looked for several tutorials online and it seems that they just somehow know where each of the points are in the array... Also, some of them vary the point numbers for mouth, for example - 49,60 instead of 49,59

i have this Error: Assertion failed (scn == 3 || scn == 4) in cv::cvtColor

0
0
i'm trying to face detect and motion detect for my internship... here is my code.... public class FaceDetect { private Button cameraButton, cropButton, pictureButton, close, compare; private ImageView originalFrame; private CheckBox haarClassifier; private CheckBox lbpClassifier; static Mat imag = null; private ScheduledExecutorService timer; private VideoCapture capture; private boolean cameraActive; private CascadeClassifier faceCascade; private int absoluteFaceSize; MatOfRect faces ; Mat grayFrame = new Mat(),frame; private Rect[] facesArray; protected void init() { this.capture = new VideoCapture(); this.faceCascade = new CascadeClassifier(); this.absoluteFaceSize = 0; } protected void startCamera() { // set a fixed width for the frame originalFrame.setFitWidth(600); // preserve image ratio originalFrame.setPreserveRatio(true); if (!this.cameraActive) { // disable setting checkboxes this.haarClassifier.setDisable(true); this.lbpClassifier.setDisable(true); this.pictureButton.setDisable(false); this.cropButton.setDisable(false); this.compare.setDisable(false); // start the video capture this.capture.open(0); // is the video stream available? if (this.capture.isOpened()) { this.cameraActive = true; // grab a frame every 33 ms (30 frames/sec) Runnable frameGrabber = new Runnable() { @Override public void run() { Image imageToShow = grabFrame(); originalFrame.setImage(imageToShow); } }; this.timer = Executors.newSingleThreadScheduledExecutor(); this.timer.scheduleAtFixedRate(frameGrabber, 0, 33, TimeUnit.MILLISECONDS); // update the button content this.cameraButton.setText("Stop Camera"); } else { // log the error System.err.println("Failed to open the camera connection..."); } } else { // the camera is not active at this point this.cameraActive = false; // update again the button content this.cameraButton.setText("Start Camera"); // enable classifiers checkboxes this.haarClassifier.setDisable(false); this.lbpClassifier.setDisable(false); this.pictureButton.setDisable(true); this.cropButton.setDisable(true); this.compare.setDisable(true); // stop the timer try { this.timer.shutdown(); this.timer.awaitTermination(33, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { // log the exception System.err.println("Exception in stopping the frame capture, trying to release the camera now... " + e); } // release the camera this.capture.release(); // clean the frame this.originalFrame.setImage(null); } } private Image grabFrame(){ // init everything Image imageToShow = null; Mat frame = new Mat(); // check if the capture is open if (this.capture.isOpened()){ try{ // read the current frame this.capture.read(frame); frame=motion(frame); // if the frame is not empty, process it if (!frame.empty()){ // face detection frame= new Mat(frame.size(), CvType.CV_8UC1); this.detectAndDisplay(frame); /*//detection of motion imag=frame; ArrayList array = new ArrayList(); Mat outerBox = new Mat(frame.size(), CvType.CV_8UC1); Imgproc.cvtColor(frame, outerBox, Imgproc.COLOR_BGR2GRAY); Imgproc.GaussianBlur(outerBox, outerBox, new Size(3, 3), 0); Mat diff_frame = new Mat(outerBox.size(), CvType.CV_8UC1); Mat tempon_frame = new Mat(outerBox.size(), CvType.CV_8UC1); Core.subtract(outerBox, tempon_frame, diff_frame); Imgproc.adaptiveThreshold(diff_frame, diff_frame, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY_INV, 5, 2); array = detection_contours(diff_frame); Iterator it2 = array.iterator(); Rect obj = it2.next(); //while (it2.hasNext()) Imgproc.rectangle(imag, obj.br(), obj.tl(), new Scalar(0, 255, 0), 1);*/ ArrayList array = new ArrayList(); array = detection_contours(motion(frame)); if (array.size() > 0) { Iterator it2 = array.iterator(); while (it2.hasNext()) { Rect obj = it2.next(); Imgproc.rectangle(imag, obj.br(), obj.tl(),new Scalar(0, 255, 0), 1); } } // convert the Mat object (OpenCV) to Image (JavaFX) imageToShow = mat2Image(imag); } } catch (Exception e){ // log the (full) error System.err.println("ERROR: " + e); } } return imageToShow; } private void detectAndDisplay(Mat fr ){ faces = new MatOfRect(); //Mat grayFrame = new Mat(); frame =fr; // convert the frame in gray scale Imgproc.cvtColor(frame, grayFrame, Imgproc.COLOR_BGR2GRAY); // equalize the frame histogram to improve the result Imgproc.equalizeHist(grayFrame, grayFrame); // compute minimum face size (20% of the frame height, in our case) if (this.absoluteFaceSize == 0){ int height = grayFrame.rows(); if (Math.round(height * 0.2f) > 0) { this.absoluteFaceSize = Math.round(height * 0.2f); } } // detect faces this.faceCascade.detectMultiScale(grayFrame, faces, 1.1, 2, 0 | Objdetect.CASCADE_SCALE_IMAGE, new Size(this.absoluteFaceSize, this.absoluteFaceSize), new Size()); // each rectangle in faces is a face: draw them! facesArray = faces.toArray(); for (int i = 0; i > 16) & 0xff; int g1 = (rgb1 >> 8) & 0xff; int b1 = (rgb1 ) & 0xff; int r2 = (rgb2 >> 16) & 0xff; int g2 = (rgb2 >> 8) & 0xff; int b2 = (rgb2 ) & 0xff; diff += Math.abs(r1 - r2); diff += Math.abs(g1 - g2); diff += Math.abs(b1 - b2); } } double n = width1 * height1 * 3; double p = diff / n / 255.0; System.out.println("diff percent: " + (p * 100.0)); String x ="diff percent: " + (p * 100.0); JFrame fenetre = new JFrame(); fenetre.setTitle("comparaison"); fenetre.setSize(400, 100); fenetre.setLocationRelativeTo(null); JPanel pan1 = new JPanel(); pan1.setLayout(new BorderLayout()); JLabel l = new JLabel(x); pan1.add(l); fenetre.add(pan1, BorderLayout.EAST); fenetre.setVisible(true); } public static ArrayList detection_contours(Mat outmat) { Mat v = new Mat(); Mat vv = outmat.clone(); List contours = new ArrayList(); Imgproc.findContours(vv, contours, v, Imgproc.RETR_LIST, Imgproc.CHAIN_APPROX_SIMPLE); double maxArea = 100; int maxAreaIdx = -1; Rect r = null; ArrayList rect_array = new ArrayList(); for (int idx = 0; idx maxArea) { // maxArea = contourarea; maxAreaIdx = idx; r = Imgproc.boundingRect(contours.get(maxAreaIdx)); rect_array.add(r); //Imgproc.drawContours(imag, contours, maxAreaIdx, new Scalar(0,0, 255)); } } v.release(); return rect_array; } public Mat motion(Mat f){ Mat frame = f; Mat outerBox = new Mat(); Mat diff_frame = null; Mat tempon_frame = null; Size sz = new Size(640, 480); int i = 0; while (true) { //camera.open(0); //if (camera.read(frame)) { Imgproc.resize(frame, frame, sz); imag = frame.clone(); outerBox = new Mat(frame.size(), CvType.CV_8UC1); Imgproc.cvtColor(frame, outerBox, Imgproc.COLOR_BGR2GRAY); Imgproc.GaussianBlur(outerBox, outerBox, new Size(3, 3), 0); if (i == 0) { diff_frame = new Mat(frame.size(), CvType.CV_8UC1); tempon_frame = new Mat(outerBox.size(), CvType.CV_8UC1); } if (i == 1) { Core.subtract(outerBox, tempon_frame, diff_frame); Imgproc.adaptiveThreshold(diff_frame, diff_frame, 255, Imgproc.ADAPTIVE_THRESH_MEAN_C, Imgproc.THRESH_BINARY_INV, 5, 2); } i = 1; return imag; }} }

How to merge new LBP training to existing one?

0
0
Hi, I have done several implementations of face recognition and currently working with LBP training models. I can create LBP face training models and call the FaceRecognizer update() to append new faces traning. Now, considering that I have 2 raspberry boards running the face recognizer service, I would need to replicate the XML training file into both boards evertyime I add a new face. Let's say I have a server that holds the faces (10 to 20 images per person) and the training XML itself. Now, I see 3 ways to let both raspberry boards updated: 1. The server service runs the update() to add up new faces to the existing XML training and then the file is downloaded to both boards. a) PROS: Only 1 file as training model all the time. b) CONS: File gets bigger and bigger all the time c) CONS: Raspberry will download bigger files (take time..) 2. The server service runs a NEW training on new faces and create a NEW XML file. Then the boards keep track of new XML files and APPEND it to its actual file. a) PROS: Server will keep lots of versioned .xml files b) PROS: Raspberry will download only the last training (small file) **c) CONS: HOW to merge/append this new XML file to existing one as I cannot use update()?** 3. Boards download the new available server's faces set and each board update() its own XML LBP training. a) PROS: Board will download only a few images

Face Tracking, pupils detection, Face rotation

0
0
I need to track eye direction. Is there any solution/api to detects pupils? Is there any known solution for tracking face rotation/direction changes. Thanks!

Unable to track faces. How to update trackers ???

0
0
I am doing a multiple faces detection & tracking. But the trackers are not updating properly. The code runs without errors when compiling. During runtime I get the below message (not error tho) ''Trackers are initialized correctly. unable to track" Here is the code: // Detect faces std::vector faces; Rect2d face_rect2d; face_cascade.detectMultiScale( image, faces, 1.2, 2, 0|CV_HAAR_SCALE_IMAGE, Size(min_face_size, min_face_size),Size(max_face_size, max_face_size) ); for(unsigned int i = 0; i tracker = Tracker::create( "MEDIANFLOW" ); // Create tracker if (tracker.empty()) { std::cerr init(image, face_rect2d)) { std::cerr update(image, face_rect2d))) { printf("unable to track\n"); } cv::rectangle(image,face_rect2d, cv::Scalar(255, 0, 255), 2, 1); }

What file do I include to use the FaceRecognizer class in the iOS framework?

0
0
Hi, I'm trying to implement the Face Recognizer class using the instructions I found [here](http://docs.opencv.org/trunk/da/d60/tutorial_face_main.html) I noticed it includes a file called `opencv2/face.hpp` which seems to contain the `cv::face` namespace and the `BasicFaceRecognizer` class. The problem is that I cant seem to find the `face.hpp` file in the opencv iOS framework which I downloaded from http://opencv.org/releases.html (I'm using OpenCV 3.2) What file do I need to include in my project to use the face recognition API? Thank You

I want to estimate age using face recognition

0
0
If you know the source code or method to recognize wrinkles or estimate age, please answer. Thank you

Face detection using Cascade Classifier in opencv pyhton

0
0
I'm trying to run the face detection code . But unable to fix the error . Help me to fix it . Thanks in advance Find the code below import numpy as np import cv2 face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') eye_cascade = cv2.CascadeClassifier('haarcascade_eye.xml') img = cv2.imread('11.jpg') gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) faces = face_cascade.detectMultiScale(gray, 1.3, 5) for (x,y,w,h) in faces: cv2.Rectangle(img,(x,y),(x+w,y+h),(255,0,0),2) roi_gray = gray[y:y+h, x:x+w] roi_color = img[y:y+h, x:x+w] eyes = eye_cascade.detectMultiScale(roi_gray) for(ex,ey,ew,eh) in eyes: cv2.Rectangle(roi_color,(ex,ey),(ex+ew,ey+eh),(0,255,0),2) cv2.imshow('img',img) cv2.waitKey(0) cv2.destroyAllWindows() Error Message: Traceback (most recent call last): File "C:\Users\vmadoori\Desktop\image processing\face_eye_detection.py", line 4, in face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') error: C:\build\master_winpack-bindings-win32-vc14-static\opencv\modules\core\src\persistence.cpp:4422: error: (-49) Input file is empty in function cvOpenFileStorage

How to construct a 3d face from 2d images in openCV?

0
0
Hello I'd like to know what openCV offers nowadays to construct a 3d face starting from 2d images. I found a similar post on the openCV forum which is now already 4 years old (http://answers.opencv.org/question/25841/conversion-of-2d-images-to-3d-and-face-recognition/). Does openCV now offer new solutions for this? If not, what other newer possibilities are there nowadays. The endgoal would be to be able to do feature extraction for every face, in order to implement face recognition.

Face Recognition error line 1010

0
0
I am a beginner in opencv project. I'm learning the tutorial in this link [link text](http://docs.opencv.org/2.4/modules/contrib/doc/facerec/tutorial/facerec_video_recognition.html) I try to solve this error. I' using opencv version 2.4.13.3 and Visual Studio 2017 on Window 10 ![image description](/upfiles/15029397909700705.jpg) my text file content ![image description](/upfiles/15029399032974651.jpg) my code from opencv website. (http://docs.opencv.org/2.4/modules/contrib/doc/facerec/tutorial/facerec_video_recognition.html) Please help me find how to solve this error. Thank you so much. ^-^




Latest Images