Ask Your Question

황인학's profile - activity

2014-07-30 06:37:06 -0600 asked a question this is my mlp code plz fix error

image description

and this is my code


int CFeMlpDlg::classyMLP(void) {

for(int tsample=0;tsample<m_tedata.rows;tsample++){;
    int maxIndex = 0;
    cv::Mat classificationResult(1,CLASSES,CV_32F);
    cv::Mat test_sample;
    test_sample = m_tedata.row(tsample);
    NN4096.predict(test_sample, classificationResult);
    float value;
    float maxValue = classificationResult.at<float>(0,0);//error 
    std::cout<<"2"<<std::endl;
    for(int index=1;index<CLASSES;index++){
        value = classificationResult.at<float>(0,index);//error
        if(value>maxValue)
        {
            maxValue = value;
            maxIndex=index;
        }
    }
    std::cout<<maxIndex<<" "<<std::endl;
}
return 0;

}


2014-05-26 11:29:51 -0600 asked a question subSpaceProjection error in android

i want fisherface in android so i create subspaceProject code

protected Mat subspaceProject(Mat _W, Mat _mean, Mat _src){
    //contribute 폴더의 lda 에 있음
    Mat X = null;
    Mat Y = null;
    Mat w = _W.clone();
    Mat mean = _mean.clone();
    Mat src = _src.clone();
    // 샘플의 차원을 가져옴
    int n = src.rows();
    int d = src.cols();
    if(w.rows() != d){
        //System.out.println("Error W.rows != src.rows");
        Log.e(TAG, "Error W.rows != src.cols");
        return null;
    }
    Log.i(TAG, "w.row="+w.rows()+"cols="+w.cols()+"src.rows="+src.rows()+"cols="+src.cols());

    src.convertTo(X, w.type());

    if(!mean.empty()){
        for(int i=0;i<n;i++){
            Mat r_i = X.row(i);
            Core.subtract(r_i, mean.reshape(1, 1), r_i);
        }
    }

    Core.gemm(X, w, 1.0, new Mat(), 0.0, Y);

    return Y;
}

and this is my log

image description

image description

2014-05-25 23:19:29 -0600 commented answer Best way to store a Mat object in Android

@firstwave

this code is too slow

2014-05-25 23:17:44 -0600 asked a question read vector(65536*5*typeis double) in android

i want recognize face i use fisherface algoritm so i create mean and w vector in pc these vector saved .xml files

i use TaFileStorage code :

http://answers.opencv.org/question/8873/best-way-to-store-a-mat-object-in-android/

but it's too slow and my phone had stopped

i want read .xml fast in android

2014-05-25 21:54:22 -0600 commented answer Best way to store a Mat object in Android

@Rui Marques

saved xml file in pc and load in android

2014-05-22 08:16:37 -0600 asked a question loading saved .xml file in android

this is my load .xml code but error occured

public Mat readmat(String tag){
    if( isWrite ) {
        System.err.println("Try read from file with write flags");
        return null;
    }

    NodeList nodelist = doc.getElementsByTagName(tag);
    Mat readMat = null;

    for( int i = 0 ; i<nodelist.getLength() ; i++ ){
        Node node = nodelist.item(i);

        if( node.getNodeType() == Node.ELEMENT_NODE ) {
            Element element = (Element)node;

            String type_id = element.getAttribute("type_id");
            if( "opencv-matrix".equals(type_id) == false) {
                System.out.println("Fault type_id ");
            }

            String rowsStr = element.getElementsByTagName("rows").item(0).getTextContent();
            String colsStr = element.getElementsByTagName("cols").item(0).getTextContent();
            String dtStr = element.getElementsByTagName("dt").item(0).getTextContent();
            String dataStr = element.getElementsByTagName("data").item(0).getTextContent();

            int rows = Integer.parseInt(rowsStr);
            int cols = Integer.parseInt(colsStr);
            int type = CvType.CV_8U;
            if( "d".equals(dtStr) ) {
                type = CvType.CV_64F;
                readMat = new Mat( rows, cols, type );
                byte[] data = Base64.decode(dataStr.getBytes(), Base64.DEFAULT);
                Log.i("FC_MainAct", ""+data.length);

                readMat.put(0, 0, data);
            }
        }
    }
    return readMat;

and this is my log

image description

2014-05-22 03:19:42 -0600 commented answer Best way to store a Mat object in Android

@Rui Marques

i want to xml convert json but my xml or yaml file too big row = 65536 , cols = 5

so how to convert it?

2014-05-21 21:57:36 -0600 commented question Loading a saved .xml file in android

@berak before create svm model i have to use pca so load mean vector and w vector xml files save these Mat var

2014-05-21 02:49:45 -0600 commented question Loading a saved .xml file in android

@berak svm model and save in my app i had sovled this problem but it's too slow so my app freezing

2014-05-21 00:30:07 -0600 asked a question Loading a saved .xml file in android

I've saved the model, mean and W in .xml in PC and load these files in my app how to load these file? W vector is 65536*5 size

///////////////////////// this is code to load Mat data from android image description

the code is too slow....... so my app is stop

2014-05-19 06:47:54 -0600 commented question i want mat to 1row mat(for SVM)

when i initalize rowMat onCreate rowMat = new Mat(1, 65536, org.opencv.core.CvType.CV_64FC1); error too

2014-05-19 06:45:37 -0600 received badge  Editor (source)
2014-05-19 06:23:38 -0600 asked a question i want mat to 1row mat(for SVM)

i want make facial emotion recognizer

this is my code image description

when i use loadface.clone().reshape(1, 1).convertTo(rowMat, org.opencv.core.CvType.CV_64FC1, 1, 0);

in MFC it is done well

but in Android image description

image size 256*256 and i think loadface is not null because when i print log.i loadface.cols and loadface.rows printed 256 256 please help me