从计算的SVM支持向量生成单个检测特征向量

时间:2015-12-31 17:42:48

标签: java android c++ opencv

我有features.dat这样的数据,比如libsvm模型,但我想将它用于hog.setSVMdetector()。我想从计算的SVM支持向量和SVM模型生成单个检测特征向量。这是我的代码

#define SVMLIGHT 1
#define LIBSVM 2


#define TRAINHOG_USEDSVM SVMLIGHT

#if TRAINHOG_USEDSVM == SVMLIGHT
    #include "svmlight/svmlight.h"
    #define TRAINHOG_SVM_TO_TRAIN SVMlight
#elif TRAINHOG_USEDSVM == LIBSVM
    #include "libsvm/libsvm.h"
    #define TRAINHOG_SVM_TO_TRAIN libSVM
#endif

static void storeCursor(void) {

}
static void resetCursor(void) {

}

static void saveDescriptorVectorToFile(vector<float>& descriptorVector, vector<unsigned int>& _vectorIndices, string fileName) {

 string separator = " "; // Use blank as default separator between single features
        fstream File;
        float percent;
        File.open(fileName.c_str(), ios::out);
        if (File.good() && File.is_open()) {

            //printf("Saving %lu descriptor vector features:\t", descriptorVector.size());
            storeCursor();
            for (int feature = 0; feature < descriptorVector.size(); ++feature) {
                if ((feature % 10 == 0) || (feature == (descriptorVector.size()-1)) ) {
                    percent = ((1 + feature) * 100 / descriptorVector.size());

                    fflush(stdout);
                    resetCursor();
                }
                File << descriptorVector.at(feature) << separator;
            }
            printf("\n");
            File << endl;
            File.flush();
            File.close();
        }
    }
    static string descriptorVectorFile = "/data/app/com.example.franksyesipangkar.tourguide/res/raw/features1.dat";

 // Generate single detecting feature vector from calculated SVM support vectors and SVM model">

        vector<float> descriptorVector;
        vector<unsigned int> descriptorVectorIndices;
        // Generate a single detecting feature vector (v1 | b) from the trained support vectors, for use e.g. with the HOG algorithm
        TRAINHOG_SVM_TO_TRAIN::getInstance()->getSingleDetectingVector(descriptorVector, descriptorVectorIndices);
        // And save the precious to file system
        saveDescriptorVectorToFile(descriptorVector, descriptorVectorIndices, descriptorVectorFile);

但是,我得到以下错误

:app:ndkBuild
[armeabi-v7a] SharedLibrary  : libImageProcessing.so
Error:error: undefined reference to 'kernel_cache_cleanup'
Error:error: undefined reference to 'free_model'
Error:error: undefined reference to 'free_example'
Error:error: undefined reference to 'my_malloc'
Error:error: undefined reference to 'verbosity'
Error:error: ld returned 1 exit status

那么,您怎么看?

0 个答案:

没有答案