Ask Your Question

Ronei's profile - activity

2017-05-25 20:55:25 -0600 asked a question biometria facial

I am studying to make a system that recognizes the person by the face, for the course completion work. However, I was unable to identify which methods to train, extract the characteristics, and identify the person. I was trying to use KNN but I have not figured it out yet. Could someone give me an idea or an example of how I can do it? I'm using java and OpenCV, but if you have an example in another language, I'm also grateful.

2017-05-25 19:42:18 -0600 received badge  Scholar (source)
2017-05-23 19:43:25 -0600 asked a question knn train erro
Mat m = Mt.converterParaMat(Mt.imagemFinal);
    m.convertTo(m, CvType.CV_32F);
    Imgproc.resize(m, m, tamanho);//tamanho 120x120
    m = m.reshape(1,200); //tamanho 200x216
    trainDados.push_back(m);
    trainLabs.add(1);

Mat xx = new Mat();
    xx = Converters.vector_int_to_Mat(trainLabs);
    xx.convertTo(xx, CvType.CV_32F);
    Imgproc.resize(xx, xx, tamanho); //tamanho 120x120
    xx.reshape(1,200); //tamanho 120x120 - não altera para 200x216?
    kn.train(trainDados, Ml.ROW_SAMPLE , xx);

retorna o erro

OpenCV Error: Assertion failed ((layout == ROW_SAMPLE && responses.rows == nsamples) || (layout == COL_SAMPLE && responses.cols == nsamples)) in cv::ml::TrainDataImpl::setData, file C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\ml\src\data.cpp, line 290 Exception in thread "AWT-EventQueue-0" CvException [org.opencv.core.CvException: cv::Exception: C:\builds\master_PackSlaveAddon-win64-vc12-static\opencv\modules\ml\src\data.cpp:290: error: (-215) (layout == ROW_SAMPLE && responses.rows == nsamples) || (layout == COL_SAMPLE && responses.cols == nsamples) in function cv::ml::TrainDataImpl::setData ] at org.opencv.ml.StatModel.train_0(Native Method) at org.opencv.ml.StatModel.train(StatModel.java:74)

java 8, opencv 3.2, windows 10