当前位置: 首页>>代码示例>>Java>>正文


Java PreProcessorFactory类代码示例

本文整理汇总了Java中ch.zhaw.facerecognitionlibrary.PreProcessor.PreProcessorFactory的典型用法代码示例。如果您正苦于以下问题:Java PreProcessorFactory类的具体用法?Java PreProcessorFactory怎么用?Java PreProcessorFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PreProcessorFactory类属于ch.zhaw.facerecognitionlibrary.PreProcessor包,在下文中一共展示了PreProcessorFactory类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onCameraFrame

import ch.zhaw.facerecognitionlibrary.PreProcessor.PreProcessorFactory; //导入依赖的package包/类
public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
    Mat imgRgba = inputFrame.rgba();
    Mat img = new Mat();
    imgRgba.copyTo(img);
    List<Mat> images = ppF.getProcessedImage(img, PreProcessorFactory.PreprocessingMode.RECOGNITION);
    Rect[] faces = ppF.getFacesForRecognition();

    // Selfie / Mirror mode
    if(front_camera){
        Core.flip(imgRgba,imgRgba,1);
    }
    if(images == null || images.size() == 0 || faces == null || faces.length == 0 || ! (images.size() == faces.length)){
        // skip
        return imgRgba;
    } else {
        faces = MatOperation.rotateFaces(imgRgba, faces, ppF.getAngleForRecognition());
        for(int i = 0; i<faces.length; i++){
            MatOperation.drawRectangleAndLabelOnPreview(imgRgba, faces[i], rec.recognize(images.get(i), ""), front_camera);
        }
        return imgRgba;
    }
}
 
开发者ID:Qualeams,项目名称:Android-Face-Recognition-with-Deep-Learning-Test-Framework,代码行数:23,代码来源:RecognitionActivity.java

示例2: onResume

import ch.zhaw.facerecognitionlibrary.PreProcessor.PreProcessorFactory; //导入依赖的package包/类
@Override
public void onResume()
{
    super.onResume();
    ppF = new PreProcessorFactory(getApplicationContext());
    numberOfTries = 0;
    animalOverlay = animalOverlayHelper.getAnimalOverlay("");
    if (animalOverlay != null) {
        mediaPlayerAnimalSound = MediaPlayer.create(this, getResources().getIdentifier(animalOverlay.getSoundFile(), AuthenticationInstructionHelper.RESOURCES_RAW_FOLDER, getPackageName()));
    }
    preview.enableView();
    mediaPlayerTabletPlacement = AuthenticationInstructionHelper.getMediaPlayerTabletPlacement(getApplicationContext());
    mediaPlayerTabletPlacement.start();
    mediaPlayerTabletPlacementOverlay = AuthenticationInstructionHelper.getMediaPlayerTabletPlacementOverlay(getApplicationContext());
    tensorFlowLoadingThread.start();
    startTimeFallback = new Date().getTime();
    startTimeAuthenticationAnimation = new Date().getTime();
}
 
开发者ID:elimu-ai,项目名称:authentication,代码行数:19,代码来源:AuthenticationActivity.java

示例3: onResume

import ch.zhaw.facerecognitionlibrary.PreProcessor.PreProcessorFactory; //导入依赖的package包/类
@Override
public void onResume()
{
    super.onResume();
    ppF = new PreProcessorFactory(getApplicationContext());
    animalOverlay = animalOverlayHelper.getAnimalOverlay(animalOverlayName);
    if (animalOverlay != null){
        mediaPlayerAnimalSound = MediaPlayer.create(this, getResources().getIdentifier(animalOverlay.getSoundFile(), AuthenticationInstructionHelper.RESOURCES_RAW_FOLDER, getPackageName()));
    }
    preview.enableView();
    if (!authenticationAnimationAlreadyPlayed){
        mediaPlayerTabletPlacement = AuthenticationInstructionHelper.getMediaPlayerTabletPlacement(getApplicationContext());
        mediaPlayerTabletPlacement.start();
    }
    mediaPlayerTabletPlacementOverlay = AuthenticationInstructionHelper.getMediaPlayerTabletPlacementOverlay(getApplicationContext());
    startTimeFallback = new Date().getTime();
    startTimeAuthenticationAnimation = new Date().getTime();
    if (authenticationAnimationAlreadyPlayed){
        prepareForAuthentication();
    }
}
 
开发者ID:elimu-ai,项目名称:authentication,代码行数:22,代码来源:StudentImageCollectionActivity.java

示例4: onResume

import ch.zhaw.facerecognitionlibrary.PreProcessor.PreProcessorFactory; //导入依赖的package包/类
@Override
public void onResume()
{
    super.onResume();

    ppF = new PreProcessorFactory(this);
    mAddPersonView.enableView();
}
 
开发者ID:Qualeams,项目名称:Android-Face-Recognition-with-Deep-Learning-Test-Framework,代码行数:9,代码来源:AddPersonPreviewActivity.java

示例5: onResume

import ch.zhaw.facerecognitionlibrary.PreProcessor.PreProcessorFactory; //导入依赖的package包/类
@Override
public void onResume()
{
    super.onResume();

    ppF = new PreProcessorFactory(getApplicationContext());

    final android.os.Handler handler = new android.os.Handler(Looper.getMainLooper());
    Thread t = new Thread(new Runnable() {
        public void run() {
            handler.post(new Runnable() {
                @Override
                public void run() {
                    progressBar.setVisibility(View.VISIBLE);
                }
            });
            SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
            String algorithm = sharedPref.getString("key_classification_method", getResources().getString(R.string.eigenfaces));
            rec = RecognitionFactory.getRecognitionAlgorithm(getApplicationContext(), Recognition.RECOGNITION, algorithm);
            handler.post(new Runnable() {
                @Override
                public void run() {
                    progressBar.setVisibility(View.GONE);
                }
            });
        }
    });

    t.start();

    // Wait until Eigenfaces loading thread has finished
    try {
        t.join();
    } catch (InterruptedException e) {
        e.printStackTrace();
    }

    mRecognitionView.enableView();
}
 
开发者ID:Qualeams,项目名称:Android-Face-Recognition-with-Deep-Learning-Test-Framework,代码行数:40,代码来源:RecognitionActivity.java

示例6: MergeThread

import ch.zhaw.facerecognitionlibrary.PreProcessor.PreProcessorFactory; //导入依赖的package包/类
public MergeThread(MergeSimilarStudentsJobService mergeService){
    Context context = mergeService.getApplicationContext();
    trainingThread = new TrainingThread(context);
    ppF = new PreProcessorFactory(context);
    LiteracyApplication literacyApplication = (LiteracyApplication) context.getApplicationContext();
    DaoSession daoSession = literacyApplication.getDaoSession();
    studentDao = daoSession.getStudentDao();
    studentImageCollectionEventDao = daoSession.getStudentImageCollectionEventDao();
    gson = new Gson();
    this.mergeService = mergeService;
}
 
开发者ID:elimu-ai,项目名称:authentication,代码行数:12,代码来源:MergeThread.java

示例7: findSimilarStudentsUsingMeanFeatureVector

import ch.zhaw.facerecognitionlibrary.PreProcessor.PreProcessorFactory; //导入依赖的package包/类
/**
 * Find similar students
 * Case 2: Student was added regularly but maybe on another tablet or due to some reason the authentication didn't recognize the student correctly in the numberOfTries
 * ---> Use the meanFeatureVector as input for the cosineSimilarityScore calculation
 * @param ppF
 * @param tensorFlow
 */
private synchronized void findSimilarStudentsUsingMeanFeatureVector(PreProcessorFactory ppF, TensorFlow tensorFlow){
    Log.i(getClass().getName(), "findSimilarStudentsUsingMeanFeatureVector");
    // Iterate through all StudentImageCollectionEvents, where the Student is not null
    List<StudentImageCollectionEvent> studentImageCollectionEvents = studentImageCollectionEventDao.queryBuilder().where(StudentImageCollectionEventDao.Properties.StudentId.notEq(0)).list();
    Log.i(getClass().getName(), "studentImageCollectionEvents.size(): " + studentImageCollectionEvents.size());
    for (StudentImageCollectionEvent studentImageCollectionEvent : studentImageCollectionEvents){
        Student student = studentImageCollectionEvent.getStudent();
        // Take the meanFeatureVector of the StudentImageCollectionEvent
        List<Float> meanFeatureVectorList = gson.fromJson(studentImageCollectionEvent.getMeanFeatureVector(), new TypeToken<List<Float>>(){}.getType());
        Mat meanFeatureVector = Converters.vector_float_to_Mat(meanFeatureVectorList);
        RecognitionThread recognitionThread = new RecognitionThread(tensorFlow, studentImageCollectionEventDao);
        recognitionThread.setImg(meanFeatureVector);
        recognitionThread.setStudent(student);
        // To indicate, that this Mat object contains the already extracted features and therefore this step can be skipped in the RecognitionThread
        recognitionThread.setFeaturesAlreadyExtracted(true);
        Log.i(getClass().getName(), "findSimilarStudentsUsingMeanFeatureVector: recognitionThread will be started to recognize student: " + student.getUniqueId());
        recognitionThread.start();
        try {
            recognitionThread.join();
            List<Student> recognizedStudents = recognitionThread.getRecognizedStudent();
            if (recognizedStudents.size() > 0){
                for (Student recognizedStudent : recognizedStudents){
                    if (recognizedStudent != null){
                        Log.i(getClass().getName(), "findSimilarStudentsUsingMeanFeatureVector: The student " + student.getUniqueId() + " has been recognized as " + recognizedStudent.getUniqueId());
                        mergeSimilarStudents(student, recognizedStudent);
                    }
                }
            } else {
                Log.i(getClass().getName(), "findSimilarStudentsUsingMeanFeatureVector: The student " + student.getUniqueId() + " was not recognized");
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
 
开发者ID:elimu-ai,项目名称:authentication,代码行数:43,代码来源:MergeThread.java

示例8: onResume

import ch.zhaw.facerecognitionlibrary.PreProcessor.PreProcessorFactory; //导入依赖的package包/类
@Override
protected void onResume() {
    super.onResume();
    ppF = new PreProcessorFactory(getApplicationContext());
    mDetectionView.enableView();
}
 
开发者ID:Qualeams,项目名称:Android-Face-Recognition-with-Deep-Learning-Test-Framework,代码行数:7,代码来源:DetectionActivity.java

示例9: findSimilarStudentsUsingAvatarImages

import ch.zhaw.facerecognitionlibrary.PreProcessor.PreProcessorFactory; //导入依赖的package包/类
/**
 * Find similar students
 * Case 1: Student was added during fallback but in the meantime the same person has an existing StudentImageCollectionEvent and a new Student entry
 * ---> Use the avatar image as input for the recognition
 * @param ppF
 * @param tensorFlow
 */
private synchronized void findSimilarStudentsUsingAvatarImages(PreProcessorFactory ppF, TensorFlow tensorFlow){
    Log.i(getClass().getName(), "findSimilarStudentsUsingAvatarImages");
    // Iterate through all Students
    List<Student> students = studentDao.loadAll();
    for (Student student : students){
        // Take the avatar image of the Student
        Mat avatarImage = Imgcodecs.imread(student.getAvatar());
        // Search for faces in the avatar image
        List<Mat> faceImages = ppF.getCroppedImage(avatarImage);
        if (faceImages != null && faceImages.size() == 1) {
            // Proceed if exactly one face has been detected
            Mat faceImage = faceImages.get(0);
            if (faceImage != null) {
                // Get detected face rectangles
                Rect[] faces = ppF.getFacesForRecognition();
                if (faces != null && faces.length == 1) {
                    // Proceed if exactly one face rectangle exists
                    RecognitionThread recognitionThread = new RecognitionThread(tensorFlow, studentImageCollectionEventDao);
                    recognitionThread.setImg(faceImage);
                    recognitionThread.setStudent(student);
                    Log.i(getClass().getName(), "findSimilarStudentsUsingAvatarImages: recognitionThread will be started to recognize student: " + student.getUniqueId());
                    recognitionThread.start();
                    try {
                        recognitionThread.join();
                        List<Student> recognizedStudents = recognitionThread.getRecognizedStudent();
                        if (recognizedStudents.size() > 0){
                            for (Student recognizedStudent : recognizedStudents){
                                if (recognizedStudent != null){
                                    Log.i(getClass().getName(), "findSimilarStudentsUsingAvatarImages: The student " + student.getUniqueId() + " has been recognized as " + recognizedStudent.getUniqueId());
                                    mergeSimilarStudents(student, recognizedStudent);
                                }
                            }
                        } else {
                            Log.i(getClass().getName(), "findSimilarStudentsUsingAvatarImages: The student " + student.getUniqueId() + " was not recognized");
                        }
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }
    }
}
 
开发者ID:elimu-ai,项目名称:authentication,代码行数:51,代码来源:MergeThread.java


注:本文中的ch.zhaw.facerecognitionlibrary.PreProcessor.PreProcessorFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。