Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to insert array of <int> into CvArr

I'm trying to develop a Face Recognition app on Android and I'm using JavaCV+OpenCV 2.4.2 to use Philipp Wagner's Face Recognition Class.

The class has a Train Method which accepts arrays of Mat and Integer as input (in C++) :

vector<Mat> images;
vector<int> labels;

Ptr<FaceRecognizer> model = createFisherFaceRecognizer();
model->train(images, labels);

JavaCV accepts the attributes of 'train' method as "train(MatVector arg0, CvArr arg1)" ... AND here is where I'm stuck !

I'm having a little trouble trying to load data into CvArr... I already have the labels as strings of data... but I can't seem to find a way to insert these labels as an array to CvArr... let's call it a lack of OpenCV knowledge... can anybody help me with this issue ?!

click to hide/show revision 2
Added some new PS Information !

How to insert array of <int> into CvArr

I'm trying to develop a Face Recognition app on Android and I'm using JavaCV+OpenCV 2.4.2 to use Philipp Wagner's Face Recognition Class.

The class has a Train Method which accepts arrays of Mat and Integer as input (in C++) :

vector<Mat> images;
vector<int> labels;

Ptr<FaceRecognizer> model = createFisherFaceRecognizer();
model->train(images, labels);

JavaCV accepts the attributes of 'train' method as "train(MatVector arg0, CvArr arg1)" ... AND here is where I'm stuck !

I'm having a little trouble trying to load data into CvArr... I already have the labels as strings of data... but I can't seem to find a way to insert these labels as an array to CvArr... let's call it a lack of OpenCV knowledge... can anybody help me with this issue ?!

P.S : BTW I know that iplImage can be used instead of CvArr in this method but the problem still remains : HOW can I insert an Array of <int> into iplImage ?!