将OpenCV Mat转换为JavaCV Mat

时间:2017-07-18 05:46:05

标签: android opencv javacv

我正在尝试使用OpenCV和JavaCV在android中创建一个新的cascadeclassifier。我在OnCameraFrame(...)函数中有以下代码,如下所示:

 @Override
public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) {
    mRgba=inputFrame.rgba();

    Imgproc.cvtColor(mRgba,imgGray,Imgproc.COLOR_RGB2GRAY);
    opencv_objdetect.CascadeClassifier face_cascade = new opencv_objdetect.CascadeClassifier(
            R.raw.lpbcascade_frontalface);
    opencv_core.RectVector faces = new opencv_core.RectVector();
    face_cascade.detectMultiScale(mRgba, faces);
    for (int i = 0; i < faces.size(); i++) {
        opencv_core.Rect face_i = faces.get(i);
    }
    return imgGray;
}

但是我在detectMultiScale函数中得到一个提示

 'Wrong 1st argument type. Found: 'org.opencv.core.Mat', required: 'org.bytedeco.javacpp.opencv_core.Mat' 

有没有办法将OpenCV Mat转换为javacv Mat?

0 个答案:

没有答案