Removed the serialization from the EarIdentifier.

parent e077deba
......@@ -2,7 +2,7 @@ package com.aluxoft.earrecognition;
import com.aluxoft.earrecognition.common.EarDatabase;
import com.aluxoft.earrecognition.common.EarFeature;
import com.aluxoft.earrecognition.common.EarIdentifierResult;
import com.aluxoft.earrecognition.common.EarIdList;
import com.aluxoft.earrecognition.utils.OpenCvUtils;
import com.google.gson.Gson;
......@@ -34,12 +34,12 @@ public class EarIdentifier {
* @param feature The result of the identification.
* @return
*/
public EarIdentifierResult identify(EarFeature feature) {
public EarIdList identify(EarFeature feature) {
return null;
}
public String computeFeatures(String imagePath) {
public EarFeature computeFeatures(String imagePath) {
Mat image, descriptors;
MatOfKeyPoint keypoints;
......@@ -55,19 +55,10 @@ public class EarIdentifier {
detector.detect(image, keypoints);
DescriptorExtractor extractor = DescriptorExtractor.create(DescriptorExtractor.SIFT);
extractor.compute(image, keypoints, descriptors);
ArrayList<ArrayList<Integer>> features = new ArrayList<>();
for (int i=0;i<descriptors.rows();++i) {
ArrayList<Integer> feature = new ArrayList<>();
for (int j=0;j<descriptors.cols();++j) {
feature.add((int)descriptors.get(i, j)[0]);
}
features.add(feature);
}
Gson gson = new Gson();
return gson.toJson(features);
return new EarFeature(descriptors);
}
static {
System.loadLibrary("opencv_java");
System.loadLibrary("nonfree");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment