當前位置: 首頁>>代碼示例>>Java>>正文


Java MatName類代碼示例

本文整理匯總了Java中ch.zhaw.facerecognitionlibrary.Helpers.MatName的典型用法代碼示例。如果您正苦於以下問題:Java MatName類的具體用法?Java MatName怎麽用?Java MatName使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


MatName類屬於ch.zhaw.facerecognitionlibrary.Helpers包,在下文中一共展示了MatName類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: saveToFile

import ch.zhaw.facerecognitionlibrary.Helpers.MatName; //導入依賴的package包/類
public void saveToFile(){
    FileHelper fh = new FileHelper();
    fh.saveIntegerList(labelList, fh.createLabelFile(fh.EIGENFACES_PATH, "train"));
    fh.saveLabelMapToFile(fh.EIGENFACES_PATH, labelMap, "train");
    MatName mOmega = new MatName("Omega", Omega);
    MatName mPsi = new MatName("Psi", Psi);
    MatName mEigVectors = new MatName("eigVectors", eigVectors);
    // Save Phi for tSNE
    MatName mPhi = new MatName("Phi", Phi);
    List<MatName> listMat = new ArrayList<MatName>();
    listMat.add(mOmega);
    listMat.add(mPsi);
    listMat.add(mEigVectors);
    listMat.add(mPhi);
    fh.saveMatListToXml(listMat, fh.EIGENFACES_PATH, filename);
}
 
開發者ID:Qualeams,項目名稱:Android-Face-Recognition-with-Deep-Learning-Library,代碼行數:17,代碼來源:Eigenfaces.java

示例2: loadFromFile

import ch.zhaw.facerecognitionlibrary.Helpers.MatName; //導入依賴的package包/類
public void loadFromFile(){
    FileHelper fh = new FileHelper();
    MatName mOmega = new MatName("Omega", Omega);
    MatName mPsi = new MatName("Psi", Psi);
    MatName mEigVectors = new MatName("eigVectors", eigVectors);
    List<MatName> listMat = new ArrayList<MatName>();
    listMat.add(mOmega);
    listMat.add(mPsi);
    listMat.add(mEigVectors);
    listMat = fh.getMatListFromXml(listMat, fh.EIGENFACES_PATH, filename);
    for (MatName mat : listMat){
        switch (mat.getName()){
            case "Omega":
                Omega = mat.getMat();
                break;
            case "Psi":
                Psi = mat.getMat();
                break;
            case "eigVectors":
                eigVectors = mat.getMat();
                break;
        }
    }
    labelList = fh.loadIntegerList(fh.createLabelFile(fh.EIGENFACES_PATH, "train"));
    labelMap = fh.getLabelMapFromFile(fh.EIGENFACES_PATH);
}
 
開發者ID:Qualeams,項目名稱:Android-Face-Recognition-with-Deep-Learning-Library,代碼行數:27,代碼來源:Eigenfaces.java

示例3: saveTestData

import ch.zhaw.facerecognitionlibrary.Helpers.MatName; //導入依賴的package包/類
@Override
public void saveTestData() {
    MatName mTestList = new MatName("TestList", testList);
    List<MatName> listMat = new ArrayList<>();
    listMat.add(mTestList);
    fh.saveMatListToXml(listMat, fh.KNN_PATH, testFile);
    fh.saveIntegerList(labelListTest, fh.createLabelFile(fh.KNN_PATH, "test"));
    fh.saveLabelMapToFile(fh.KNN_PATH, labelMapTest, "test");
}
 
開發者ID:Qualeams,項目名稱:Android-Face-Recognition-with-Deep-Learning-Library,代碼行數:10,代碼來源:KNearestNeighbor.java

示例4: loadFromFile

import ch.zhaw.facerecognitionlibrary.Helpers.MatName; //導入依賴的package包/類
@Override
public void loadFromFile() {
    MatName mtrainingList = new MatName("TrainingList", trainingList);

    List<MatName> listMat = new ArrayList<MatName>();
    listMat.add(mtrainingList);

    labelList = fh.loadIntegerList(fh.createLabelFile(fh.KNN_PATH, "train"));
    labelMap = fh.getLabelMapFromFile(fh.KNN_PATH);
    trainingList = fh.getMatListFromXml(listMat, fh.KNN_PATH, trainingFile).get(0).getMat();

    labels = new Mat(labelList.size(), 1, CvType.CV_8UC1);
    for (int i=0; i<labelList.size(); i++) {
        Integer label = labelList.get(i);
        // Fill shorter labels with 0s
        labels.put(i, 0, label);
    }

    labels.convertTo(labels, CvType.CV_32F);
    PreferencesHelper preferencesHelper = new PreferencesHelper(context);
    k = preferencesHelper.getK();

    knn = KNearest.create();
    knn.setIsClassifier(true);
    knn.train(trainingList, 0,labels);

}
 
開發者ID:Qualeams,項目名稱:Android-Face-Recognition-with-Deep-Learning-Library,代碼行數:28,代碼來源:KNearestNeighbor.java

示例5: saveTestData

import ch.zhaw.facerecognitionlibrary.Helpers.MatName; //導入依賴的package包/類
@Override
public void saveTestData() {
    FileHelper fh = new FileHelper();
    fh.saveIntegerList(labelListTest, fh.createLabelFile(fh.EIGENFACES_PATH, "test"));
    fh.saveLabelMapToFile(fh.EIGENFACES_PATH, labelMapTest, "test");
    MatName mTestList = new MatName("TestList", testList);
    List<MatName> listMat = new ArrayList<>();
    listMat.add(mTestList);
    fh.saveMatListToXml(listMat, fh.EIGENFACES_PATH, "testlist.xml");
}
 
開發者ID:Qualeams,項目名稱:Android-Face-Recognition-with-Deep-Learning-Library,代碼行數:11,代碼來源:Eigenfaces.java

示例6: storeStudentImages

import ch.zhaw.facerecognitionlibrary.Helpers.MatName; //導入依賴的package包/類
/**
 * Stores all the buffered StudentImages to the file system and database
 */
private synchronized void storeStudentImages(){
    new Thread(new Runnable() {
        @Override
        public void run() {
            StudentImageCollectionEvent studentImageCollectionEvent = new StudentImageCollectionEvent();
            studentImageCollectionEvent.setTime(Calendar.getInstance());
            studentImageCollectionEvent.setDevice(device);
            Long studentImageCollectionEventId = studentImageCollectionEventDao.insert(studentImageCollectionEvent);
            for(int i=0; i<studentImages.size(); i++){
                MatName matName = new MatName(Integer.toString(i), studentImages.get(i));
                FileHelper fileHelper = new FileHelper();
                String wholeFolderPath = StudentHelper.getStudentImageDirectory() + "/" + device.getDeviceId() + "/" + Long.toString(studentImageCollectionEventId);
                new File(wholeFolderPath).mkdirs();
                fileHelper.saveMatToImage(matName, wholeFolderPath + "/");

                String imageUrl = wholeFolderPath + "/" + Integer.toString(i) + ".png";
                StudentImage studentImage = new StudentImage();
                studentImage.setTimeCollected(Calendar.getInstance());
                studentImage.setImageFileUrl(imageUrl);
                studentImage.setStudentImageCollectionEvent(studentImageCollectionEvent);
                studentImageDao.insert(studentImage);
            }
            Log.i(getClass().getName(), "storeStudentImages has finished successfully.");

            // Initiate background job for face recognition training
            BootReceiver.scheduleFaceRecognitionTranining(getApplicationContext());

        }
    }).start();
}
 
開發者ID:elimu-ai,項目名稱:authentication,代碼行數:34,代碼來源:StudentImageCollectionActivity.java

示例7: saveMatToImage

import ch.zhaw.facerecognitionlibrary.Helpers.MatName; //導入依賴的package包/類
private String saveMatToImage(Mat img){
    MatName m = new MatName("caffe_vector", img);
    return fh.saveMatToImage(m, fh.CAFFE_PATH);
}
 
開發者ID:Qualeams,項目名稱:Android-Face-Recognition-with-Deep-Learning-Library,代碼行數:5,代碼來源:Caffe.java

示例8: saveToFile

import ch.zhaw.facerecognitionlibrary.Helpers.MatName; //導入依賴的package包/類
@Override
public void saveToFile() {

    fh.saveIntegerList(labelList, fh.createLabelFile(fh.KNN_PATH, "train"));
    fh.saveLabelMapToFile(fh.KNN_PATH, labelMap, "train");

    MatName mtrainingList = new MatName("TrainingList", trainingList);

    List<MatName> listMat = new ArrayList<MatName>();
    listMat.add(mtrainingList);

    fh.saveMatListToXml(listMat, fh.KNN_PATH, trainingFile);
}
 
開發者ID:Qualeams,項目名稱:Android-Face-Recognition-with-Deep-Learning-Library,代碼行數:14,代碼來源:KNearestNeighbor.java


注:本文中的ch.zhaw.facerecognitionlibrary.Helpers.MatName類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。