1 | initial version |
Pay attention on mat data types and convertTo params:
source.convertTo(destination, type)
Fixed code:
Mat maskColor = new Mat( mBitmapPintar.getHeight(), mBitmapPintar.getWidth(), CvType.CV_8UC3);
Mat maskgris = new Mat( maskColor.rows(), maskColor.cols(), CvType.CV_8U );
Mat mask = new Mat( maskColor.rows(), maskColor.cols(), CvType.CV_32F);
Imgproc.cvtColor( maskColor, maskgris, Imgproc.COLOR_BGR2GRAY);
Highgui.imwrite(directoriFitxer + "/maskengris.jpg", maskgris);
maskgris.convertTo(mask, CvType.CV_32F);
mask.convertTo(maskgris, CvType.CV_8U);
Highgui.imwrite(directoriFitxer + "/maskengrisDespConv.jpg", maskgris);