What exactly does cuGraphicsResourceGetMappedEglFrame do?

The Argus cudaHistogram sample shows a way to move images quickly from the camera into the GPU, but it only can act on the luminance channel.

From what I can tell, the cuGraphicsResourceGetMappedEglFrame gives you a pointer to a something that wants to be turned into to a 2d surface. Because this sample code works

CUDA_RESOURCE_DESC cudaResourceDesc;
        memset(&cudaResourceDesc, 0, sizeof(cudaResourceDesc));
        cudaResourceDesc.resType = CU_RESOURCE_TYPE_ARRAY;
        cudaResourceDesc.res.array.hArray = cudaEGLFrame.frame.pArray[0];
        CUsurfObject cudaSurfObj = 0;
        cuResult = cuSurfObjectCreate(&cudaSurfObj, &cudaResourceDesc);

But change that pArray[0] to pArray[1] to try to get at the color information and it stops working.

How can one convert that CUeglFrame into a straightforward array of integers so that you can do some calculations on it?

Hi,

Thanks for your question.

Could you check backend sample in MMAPI first?
This sample can give you some hint about cuGraphicsResourceGetMappedEglFrame().

Located at:
‘/home/ubuntu/tegra_multimedia_api/samples/backend/v4l2_backend_main.cpp’