interchange of ID3D11Texture2D and InputArray

I have some code that needs to:

  • copy from CPU memory to GPU memory
  • call cv::cuda::cvtColor( InputArray src, OutputArray dst, int, int, Stream & )
  • copy result of the OutputArray dst to a ID3D11Texture2D texture that was created from the same device context, but was not created from me (it was created externally, using my device context!)

trouble is, I don’t know how to perform that copy. I’ve been fooling around with trying to create mapped textures & stuff, but nothing is straight-forward… I was using GpuMats to call cvtColor, but I’m not married to that idea.

pointers to code would be appreciated. I know about cudaGraphicsD3D11RegisterResource, cudaGraphicsSubResourceGetMappedArray, cudaCreateTextureObject, etc, but how to use them isn’t exactly clear, and certainly how to pass the result of one of those functions to cvtColor( ) is eluding me.