Ask Your Question

alex011235's profile - activity

2016-08-16 09:13:57 -0600 commented question Android OpenCV 3.1 seamlessclone

It seems to work! Thank you very much!

2016-08-16 08:45:56 -0600 commented question Android OpenCV 3.1 seamlessclone

I removed them. But I think Java sends 4-channel images, so I have to convert them to 3-channel images.

2016-08-16 08:14:03 -0600 received badge  Editor (source)
2016-08-16 07:59:49 -0600 commented question Android OpenCV 3.1 seamlessclone

In Java:

    BitmapFactory.Options options = new BitmapFactory.Options();
    options.inSampleSize = 1;

    bitmap1 = BitmapFactory.decodeFile(path1, options);
    bitmap2 = BitmapFactory.decodeFile(path2, options);

    Mat img1 = new Mat();
    bitmapToMat(bitmap1, img1);
    Mat img2 = new Mat();
    bitmapToMat(bitmap2, img2);

where path1 and path2 are the paths to the bitmaps.

In C++:

Mat img1 = *(Mat*)addrImg1;
Mat img2 = *(Mat*)addrImg2;

where the addrImg1 and addrImg2 are jlong:s

2016-08-16 07:13:28 -0600 asked a question Android OpenCV 3.1 seamlessclone

I'm trying to execue the following lines in native OpenCV for Android (C++). And everything compiles.

warpedSub.convertTo(warpedSub, CV_8UC3);
img2sub.convertTo(img2sub, CV_8UC3);
output.convertTo(output, CV_8UC3);
maskSub.convertTo(maskSub, CV_8UC1);

seamlessClone(warpedSub, img2sub, maskSub, center, output, NORMAL_CLONE);

But I get this error when executing:

 E/cv::error(): OpenCV Error: Assertion failed (CV_MAT_TYPE(mtype) == m.type()) in void cv::_OutputArray::create(int, const int*, int, int, bool, int) const, file /builds/master_pack-android/opencv/modules/core/src/matrix.cpp, line 2236

According to the OpenCV documentation, I have the correct types. I have also tested a prototype completely in C++ on my desktop computer and it all works fine! I don't know what to do, please help!