5

I want to use OpenCV's FaceRecognition in java through javacv wrapper library. I don't know how to pass images and labels to com.googlecode.javacv.cpp.opencv_contrib.FaceRecognizer.train(CvArr, CvArr)

I can use cvLoadImage(String) or cvLoadImageM(String) to obtain single images, but how do I make an CvArr of them?

milan
  • 2,355
  • 2
  • 23
  • 38

2 Answers2

1

After some reading I found out that CvArr is an opaque type. You just initialize with any data - it is just a C pointer after all. So:

CvMat[] images = new CvMat[n];
images[0] = cvLoadImageM(...);
...
CvArr arr = new CvArr(new CvMatArray(images));
milan
  • 2,355
  • 2
  • 23
  • 38
0

This post is about using the Contrib Module with JavaCV. It also explains how to pass the images to the wrapped functions:

Community
  • 1
  • 1
bytefish
  • 3,697
  • 1
  • 29
  • 35