Using OCV 4.5; C++, Visual Studio 2017; MFC; Windows 10
I am trying to convert some Mat code to UMat. An example line would be
myMat.at(i, j) = temp_s;
I get the error that ‘at’ is not a member of Umat.
What would be the equivalent for a UMat. In other words, I want to access each pixel of a UMat and make changes.
Ed
berak
October 21, 2021, 4:43pm
2
there is no such thing, this is where CPU and GPU progamming differs
in general, there are no “random access” operations on the GPU
(no (i,j), no drawing)
if you cannot express your idea “as vectors”, it’s not possible on the GPU.
Thanks…I was afraid that was the case.
Ed
yes, UMats are opaque to the CPU. you’d have to “getMat
” the contents of a UMat, which is returned as a Mat… and then you probably need to stick it in another UMat again
https://docs.opencv.org/master/d7/d45/classcv_1_1UMat.html#a3d84c72c06ddd55d35b87c3d222d2674
Thanks. Apparently that would defeat the purpose of me trying to use UMat in the first place…oh well.