Ask Your Question

Ankit Verma's profile - activity

2017-05-02 04:55:04 -0600 commented question OpenCV 3 Java - How to train neural network with TrainData

this is the error:

E/org.opencv.ml: ml::create_11() caught cv::Exception: /build/master_pack-android/opencv/modules/ml/src/data.cpp:259: error: (-215) samples.type() == CV_32F || samples.type() == CV_32S in function void cv::ml::TrainDataImpl::setData(cv::InputArray, int, cv::InputArray, cv::InputArray, cv::InputArray, cv::InputArray, cv::InputArray, cv::InputArray)

2017-05-02 04:55:04 -0600 commented question OpenCV 3 Java - How to train neural network with TrainData

Dear Sipho, I am completely new to OpenCv with Android + java. It would be of great help if you or anyone here can help me understand how do I interpret images as MAT so as to train my classifier.

My code is: strong text Mat originalMat = new Mat(); Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.a); Utils.bitmapToMat(bmp,originalMat);

              NormalBayesClassifier classifier = NormalBayesClassifier.create();
                TrainData td = TrainData.create(originalMat, Ml.ROW_SAMPLE, originalMat);
                classifier.train(originalMat,Ml.ROW_SAMPLE,originalMat);

: