Example usage for org.opencv.utils Converters vector_float_to_Mat

List of usage examples for org.opencv.utils Converters vector_float_to_Mat

Introduction

In this page you can find the example usage for org.opencv.utils Converters vector_float_to_Mat.

Prototype

public static Mat vector_float_to_Mat(List<Float> fs) 

Source Link

Usage

From source file:ch.zhaw.facerecognitionlibrary.Recognition.Caffe.java

License:Open Source License

public Mat getFeatureVector(Mat img) {
    float[][] vector = caffe.getRepresentationLayer(saveMatToImage(img), layer);

    List<Float> fVector = new ArrayList<>();
    for (float f : vector[0]) {
        fVector.add(f);/*  w w w  . j  a v  a 2s  .  co m*/
    }

    return Converters.vector_float_to_Mat(fVector);
}

From source file:ch.zhaw.facerecognitionlibrary.Recognition.TensorFlow.java

License:Open Source License

public Mat getFeatureVector(Mat img) {
    Imgproc.resize(img, img, new Size(inputSize, inputSize));

    Bitmap bmp = Bitmap.createBitmap(inputSize, inputSize, Bitmap.Config.ARGB_8888);
    Utils.matToBitmap(img, bmp);//w  w  w.  j a  v a2  s .com

    String[] sVector = classifyImageBmp(inputLayer, outputLayer, outputSize, bmp).split(STRING_SPLIT_CHARACTER);

    System.out.println(sVector.length);

    List<Float> fVector = new ArrayList<>();
    for (String s : sVector) {
        fVector.add(Float.parseFloat(s));
    }

    return Converters.vector_float_to_Mat(fVector);
}