I convert UIImage to Mat like this:(On iOS) UIImageToMat(image1, baseImage, true);
And use imwrite("/home/before.png", baseImage); the output image is ok.
I use the code like this: cvtColor(baseImage, baseImageB, COLOR_BGRA2GRAY);
And use imwrite("/home/after.png", baseImageB); the output image is black.
and save it to txt file, it seems that there a many zeros, and at last some lines of 1.94871e+09 or some other value.
And I tried COLOR_BGR2GRAY, RGB2GRAY, RGBA2GRAY, all failed.
How to get the right gray image?
Thanks!