I was trying to port an existing C++ desktop project to Android. For this I need to read images from the file system - which I was able do to now with copying the .jpg files in code.
Now I am facing this error:
OpenCV Error: Assertion failed (src.type() == CV_8UC1) in void createReflectionMask(const cv::Mat&, cv::Mat&, float, float, int, int), file jni/wahet.cpp, line 782
Code:
Mat img = imread(*inFile);
CV_Assert(img.data != 0);
Mat orig;
if (!segresFiles.empty())
img.copyTo(orig);
int width = img.cols;
int height = img.rows;
Mat mask(height, width, CV_8UC1);
createReflectionMask(img, mask);
void createReflectionMask(const Mat& src, Mat& mask) {
CV_Assert(src.type() == CV_8UC1);
Error thrown in the first line of createReflectionMask()
.
As I used the code of this project under Windows with the same images there must be some problem with the Android file system or copying the files.