资源简介

javacv配置+javacv人脸识别代码。javacv配置+javacv人脸识别代码。javacv配置+javacv人脸识别代码

资源截图

代码片段和文件信息

	



import com.googlecode.javacpp.FloatPointer;
import com.googlecode.javacpp.Pointer;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import static com.googlecode.javacv.cpp.opencv_highgui.*;
import static com.googlecode.javacv.cpp.opencv_highgui.cvDestroyWindow;
import static com.googlecode.javacv.cpp.opencv_legacy.*;
import static com.googlecode.javacv.cpp.opencv_objdetect.CV_HAAR_DO_CANNY_PRUNING;
import static com.googlecode.javacv.cpp.opencv_objdetect.CV_HAAR_FIND_BIGGEST_object;
import static com.googlecode.javacv.cpp.opencv_objdetect.CV_HAAR_DO_ROUGH_SEARCH;
import static com.googlecode.javacv.cpp.opencv_objdetect.cvHaarDetectobjects;
import static com.googlecode.javacv.cpp.opencv_imgproc.CV_BGR2GRAY; 
import static com.googlecode.javacv.cpp.opencv_imgproc.cvEqualizeHist;

import com.googlecode.javacpp.Loader;
import com.googlecode.javacv.*;
import com.googlecode.javacv.frameGrabber.Exception;
import com.googlecode.javacv.cpp.opencv_core;
import com.googlecode.javacv.cpp.opencv_core.CvFont;
import com.googlecode.javacv.cpp.opencv_core.CvMemStorage;
import com.googlecode.javacv.cpp.opencv_core.CvRect;
import com.googlecode.javacv.cpp.opencv_core.CvScalar;
import com.googlecode.javacv.cpp.opencv_core.CvSeq;
import com.googlecode.javacv.cpp.opencv_core.IplImage;
import com.googlecode.javacv.cpp.opencv_objdetect.CvHaarClassifierCascade;

import static com.googlecode.javacv.cpp.opencv_core.*;
import static com.googlecode.javacv.cpp.opencv_imgproc.*;
import static com.googlecode.javacv.cpp.opencv_calib3d.*;
import static com.googlecode.javacv.cpp.opencv_objdetect.*;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.*;

public class FaceRecognizer{

  private static final Logger LOGGER = Logger.getLogger(FaceRecognizer.class.getName());
  private int nTrainFaces = 0;
  private int nPersons=0;
  private int nEigens = 0;
  private int count=1;
  private int countForFace=0;
  private int countSavedFace=1;
  private CvMat personNumTruthMat;
  private  CvMat eigenValMat;
  private CvMat projectedTrainFaceMat;
  private CvMat trainPersonNumMat=null; 
  final static List personNames = new ArrayList();
  private CvHaarClassifierCascade cascade = new CvHaarClassifierCascade(cvLoad(“data\\haarcascade_frontalface_alt2.xml“));
  
  IplImage[] eigenVectArr;
  IplImage[] trainingFaceImgArr;
  IplImage[] testFaceImgArr;
  IplImage pAvgTrainImg;
 
  
  public static String personName;
  private static String textName=“unknow“;
  
  public static double g_confidence=0;  
  
  
  public FaceRecognizer() {
  trainPersonNumMat = loadTrainingData();
  }
  
  
  private void learn(final String trainingFileName) {
    int i;

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2013-11-08 17:59  ForFun\
     文件         643  2013-11-08 16:26  ForFun\.classpath
     文件         502  2013-06-15 00:26  ForFun\.project
     目录           0  2013-11-08 17:59  ForFun\.settings\
     文件         629  2013-06-15 00:23  ForFun\.settings\org.eclipse.jdt.core.prefs
     目录           0  2013-11-08 18:06  ForFun\bin\
     文件       27554  2013-11-08 18:15  ForFun\bin\FaceRecognizer.class
     文件         996  2013-11-08 18:06  ForFun\bin\LoginShell$1.class
     文件         969  2013-11-08 18:06  ForFun\bin\LoginShell$2.class
     文件        3100  2013-11-08 18:06  ForFun\bin\LoginShell.class
     文件        1679  2013-11-08 18:05  ForFun\bin\RegisterShell$1.class
     文件        2297  2013-11-08 18:05  ForFun\bin\RegisterShell.class
     目录           0  2013-11-08 17:59  ForFun\data\
     文件          21  2013-11-08 18:16  ForFun\data\facedata.xml
     文件           0  2013-11-08 18:16  ForFun\data\ForTraining.txt
     文件      837462  2013-06-15 03:36  ForFun\data\haarcascade_frontalface_alt2.xml
     目录           0  2013-11-08 18:16  ForFun\img\
     目录           0  2013-11-08 17:59  ForFun\lib\
     文件      119676  2013-06-15 03:14  ForFun\lib\javacpp.jar
     文件     1245448  2013-06-15 03:14  ForFun\lib\javacv-windows-x86.jar
     文件     1589353  2013-03-03 18:16  ForFun\lib\javacv-windows-x86_64.jar
     文件     1093839  2013-06-15 03:14  ForFun\lib\javacv.jar
     目录           0  2013-11-08 17:59  ForFun\src\
     文件       33633  2013-11-08 18:15  ForFun\src\FaceRecognizer.java
     文件        3096  2013-11-08 18:06  ForFun\src\LoginShell.java
     文件        2445  2013-11-08 17:41  ForFun\src\RegisterShell.java
     文件     2304990  2010-02-12 14:20  ForFun\swt-64.jar
     文件     1890742  2013-10-13 10:55  ForFun\swt_32.jar
     目录           0  2013-11-08 17:58  T\
     文件         581  2013-11-08 17:58  T\.classpath
     文件         377  2013-11-08 17:58  T\.project
............此处省略6个文件信息

评论

共有 条评论