How to convert Mat <-> UMat back-and-forth
I'd like to know how to convert UMat image onto Mat and back-and-forth. I do calculation on input image which I read/write
UMat img,gray;
imread("lena.jpg", 1).copyTo(img);
cvtColor(img, gray, COLOR_BGR2GRAY);
imwrite("lena_gray.jpg", gray);
I have OpenCV 3.4.1. and after imwrite() call I got
Segmentation fault (core dumped)
There is a bug #11176 of segmentation fault if UMat saved by imwrite() call So I'm thinking to convert to Mat and after then to save. How to convert UMat to Mat back-and-forth? Or is there any other solution to write UMat image instead?