Index GpuMat channels without copying
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!
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.