argus and opencv

hey,

does it’s possible to read a video file and pass it through opencv by using the argus library?

Furthermore as I am using an ip Camera (I already save the video to a file), the argus library would need to not stop reading frame even though the file is being written.

Do you think it’s possible?

Thanks in advance.

Please refer to this thread.

https://devtalk.nvidia.com/default/topic/1037863/jetson-tx2/argus-and-opencv/

the problem is that I do not have any CSI camera as I am using ip Camera so it’s hard to understand argus and cuda without being able to even test it.

02_video_dec_cuda is what I want to do but I am stuck on passing the image to opencv or do the opposite by changing 09_camera_jpeg_capture to accept a file input.

What would be the relevant lines of code that I could write in 02_video_dec_cuda to have a exploitable image in opencv ?

Hi blitzfr,
Please refer to
https://devtalk.nvidia.com/default/topic/1037863/jetson-tx2/argus-and-opencv/post/5273400/#5273400

You can check:

+    void *pdata = NULL;
+
+    NvBufferMemMap(fd, 0, NvBufferMem_Read, &pdata);
+    NvBufferMemSyncForCpu(fd, 0, &pdata);
+
+    cv::Mat imgbuf = cv::Mat(PREVIEW_SIZE.height(),
+                             PREVIEW_SIZE.width(),
+                             CV_8UC4, pdata);
+    cv::Mat display_img;
+    cvtColor(imgbuf, display_img, CV_RGBA2BGR);
+
+    NvBufferMemUnMap(fd, 0, &pdata);
+
+    cv::imshow("img", display_img);
+    cv::waitKey(1);

It shows how to map NvBuffer to cv::Mat.