Try to get sensor raw data in jetpack 4.6.1 sdk jetson_multimedia_api cudaBayerDemosaic sample libargus , but failed? something else MUST be wrong. pl

i want to get the jetson xavier mipi raw sensor data , and i try the cudaBayerDemosaic sampel code based libargus. i found that i should get bayer raw data from the function below in CudaBayerDemosaicConsumer.cpp

bool CudaBayerDemosaicConsumer::threadExecute()
{


}

and i write the capture code to try to save every frame from cuda driver API, but the raw
data seems not corret, because i can not use raw data tools( imageJ) to show the raw data.
i am not sure wether is ok to get raw data from the bayerEglFrame .

ANY ONE can help?
thank you

    // Get the Bayer EGL frame information from the CUDA resource.
    CUeglFrame bayerEglFrame;
    memset(&bayerEglFrame, 0, sizeof(bayerEglFrame));
    cuResult = cuGraphicsResourceGetMappedEglFrame(&bayerEglFrame, bayerResource, 0, 0);
    if (cuResult != CUDA_SUCCESS)
    {
        ORIGINATE_ERROR("Unable to get the CUDA EGL frame (CUresult %s)",
            getCudaErrorString(cuResult));
    }

    // On the first frame, print the information contained in the CUDA EGL frame structure.
    //if (frame == 0)
    {
        printf("CUDA CONSUMER:    Input frame format:\n");
        PROPAGATE_ERROR(printCUDAEGLFrame(bayerEglFrame));
		char pName[128];
		sprintf(pName, "%d.raw",frame);
		FILE *fp = fopen(pName,"wb");
		if (fp != NULL)
		{
			char *p_buf = (char *)malloc(bayerEglFrame.width * bayerEglFrame.height);
			cudaMemcpyDtoH(p_buf, bayerEglFrame.frame.pPitch[0], bayerEglFrame.width * bayerEglFrame.height);
			fwrite(p_buf, bayerEglFrame.width * bayerEglFrame.height, 1, fp);				
			fclose(fp);
			free(p_buf);
		}
    }

Hi,
Probably you don’t read it correctly. If the RAW data is wrong, the result of cudaBayerDemosaic() shall be wrong also. Please dump rgbaEglFrame and check if it is correct.

thank you, i will try it soon. and i just want to get raw data from bayerEglFrame , does it work theoretically?

i read the data from rgbaEglFrame and use imageJ to show it ok, but from bayerEglFrame is not ok use the same method . why not get raw data from bayerEglFrame ? or Must by other interface?

Hi,
You may try to capture and dump RAW frames through v4l2-ctl command and check if it is correct.

And can print out pitch, width and height of bayerEglFrame to confirm the values are expected.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.