Saving ORB feature vectors using OpenCV4Android (java API)

后端 未结 3 1380
日久生厌
日久生厌 2021-01-02 14:37

I have a training set of images, for each of which I\'ve detected and computed their feature vectors (using ORB feature descriptors and extractors. The questions is<

3条回答
  •  长情又很酷
    2021-01-02 15:08

    In my opinion the most universal way to store the keypoints is to first convert them to a data-interchange format like JSON.

    After you are able to do that conversion you have a lot of flexibility to store it. JSON is easily converted to a String and/or sent through a network connection.

    With OpenCV C++ you are able to store data as YAML, but that is not available for Android yet.

    To parse JSON in Java you can use this easy to use library Google GSON.

    And here is my first attempt to do exactly that:

     public static String keypointsToJson(MatOfKeyPoint mat){
        if(mat!=null && !mat.empty()){          
            Gson gson = new Gson();
    
            JsonArray jsonArr = new JsonArray();            
    
            KeyPoint[] array = mat.toArray();
            for(int i=0; i

提交回复
热议问题