Index GpuMat channels without copying

asked 2016-11-08 14:07:49 -0600

mescarra gravatar image

Hello everybody!

I am currently using OpenCV-3.1 and I was wondering whether there was a way of indexing a cv::cuda::GpuMat channels without calling cv::cuda::split.

I don't need to write to these channels, I just need to perform arithmetic operations with each channel separately and save them somewhere else (i.e., cv::cuda::divide(gpu_red, gpu_blue, gpu_rdb) ).

I don't want to use split because it copies matrices and it's very computationally expensive (it is currently, by far, my app's bottleneck).

Any ideas would be appreciated. Thanks!

edit retag flag offensive close merge delete

Comments

Just like a Mat element, I am guessing that internally a GpuMat will be stored as a memory vector. That means that if you know the size of your image, you can index it by jumping to the correct memory location. Take a look at this SO topic.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-11-09 04:20:23 -0600 )edit