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);
}
}