Hello! i am currently running opencv for android and i am trying to turn recolor image A based on a template from image B. from what i understood this is done by mask. this is my code, it crashes.. any clue why?
// data from camera converted into matrix
Mat mat = new Mat(mHeight+mHeight/2,mWidth, CvType.CV_8UC1);
mat.put(0, 0, data);
Mat mRGB = new Mat();
Imgproc.cvtColor(mat, mRGB, Imgproc.COLOR_YUV2RGB_NV21, 4);
Core.flip(mRGB.t(), mRGB, 0);
Core.flip(mRGB, mRGB, 1);
mRGB.convertTo(mRGB, CvType.CV_8UC1);
Mat newMat = new Mat(mRGB.height(),mRGB.width(),CvType.CV_8UC1, new Scalar(4));
// template is a jpg file loaded into the matrix called template. CvType.CV_8UC1
mRGB.copyTo(newMat,template);
can anyone explain to me how can i perform this? image B (template) is black and white (only 00000,FFFFF) i want that if pixel i,j is black in image B (template) it will be black in newMat. otherwise keep the pixel from image A.