Hi ,
I have mapped the NVMM memory to opencv by using the following code
configFlag = false;
NvBufSurface *surface = frameQueue.pop();
NvBufSurfaceMapEglImage(surface, 0);
CUresult status;
CUeglFrame eglFrame;
CUgraphicsResource pResource = NULL;
cudaFree(0);
status = cuGraphicsEGLRegisterImage(&pResource, surface->surfaceList[0].mappedAddr.eglImage, CU_GRAPHICS_MAP_RESOURCE_FLAGS_NONE);
if (status != CUDA_SUCCESS) {
printf("cuGraphicsEGLRegisterImage failed: %d \n", status);
}
status = cuGraphicsResourceGetMappedEglFrame(&eglFrame, pResource, 0, 0);
status = cuCtxSynchronize();
cv::cuda::GpuMat d_mat(h, w, CV_8UC4, eglFrame.frame.pPitch[0]);
cv::cuda::cvtColor(d_mat, img_RGB, cv::COLOR_RGBA2BGR);
Now i am stuck with how to map the same memory to OpenGL?I have tried mutilple ways but failed please give suggestions…
@DaneLLL
Thanks in advance …
Hi,
For information, which Jetson platform you are using? And which Jetpack version?
Hi DaneLLL,
Thanks for your quick response.
Processor : Jetson Xaveir
Jetpack version is : 5.1.1{l4t 35.3.1}
.
@DaneLLL
Hi,
A user has shared a method in
Trying to process with OpenGL an EGLImage created from a dmabuf_fd - #9 by DaneLLL
It is based on NvBuffer in Jetpack 4 and it should be able to do the same for NvBufSurface in Jetpack 5. Please check the sample and give it a try.
Thanks Dane let me have a try.
Hai,
I have one doubt regrding the pipeline
launch_stream << "nvarguscamerasrc name=mysource ! "
<< "video/x-raw(memory:NVMM),width="<< w <<",height="<< h <<",framerate=30/1,format=NV12 ! "
<< "nvvidconv name=myconv output-buffers=40 ! "
<< "video/x-raw(memory:NVMM),format=RGBA ! "
<< "fakesink";
How to place a normal mp4 video instead of argus camera with this command
(By using this pipline i am extracting the NVMM memory to opencv GPU )
From argus camera it is working i need the same pipline to take input as a video
thanks in advance
@DaneLLL
Hi,
For decoding mp4 file, the pipeline will be like:
filesrc location=test.mp4 ! qtdemux ! h264parse ! nvv4l2decoder ! nvvidconv ! 'video/x-raw(memory:NVMM),format=RGBA' ! fakesink
Please apply the pipeline and try.