This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: OpenCV not able to open IMX219 camera

Part Number: TDA4VM

Tool/software:

Hi,

I'm using TDA4VM board and using SDK v9. I have configured the uEnv.txt to enable IMX219 and in Ti's out-of-box code, IMX 219 is working fine.

However, when I tried to run my OpenCV code and open the camera using 

VideoCapture cap("/dev/video-imx219-cam0");

It gave me this error:
[ WARN:0@0.271] global /usr/src/debug/opencv/4.5.5-r0/git/modules/videoio/src/cap_gstreamer.cpp (2401) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module source reported: Could not read from resource.
[ WARN:0@0.272] global /usr/src/debug/opencv/4.5.5-r0/git/modules/videoio/src/cap_gstreamer.cpp (1356) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0@0.272] global /usr/src/debug/opencv/4.5.5-r0/git/modules/videoio/src/cap_gstreamer.cpp (862) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
[ WARN:0@10.338] global /usr/src/debug/opencv/4.5.5-r0/git/modules/videoio/src/cap_v4l.cpp (1000) tryIoctl VIDEOIO(V4L2:/dev/video-imx219-cam0): select() timeout.
zxing-cpp deprecation warning: ImageView(nullptr, ...) will throw in the future, use ImageView()
terminate called after throwing an instance of 'std::invalid_argument'
what(): ImageView is null/empty
Aborted (core dumped)

I thought it was because gstreamer not correctly configured, so I followed the TI's gstreamer code, and input the camera like this:

std
::string pipeline = "v4l2src device=/dev/video-imx219-cam0 io-mode=5 ! queue leaky=2 ! video/x-bayer, width=1920, height=1080, format=rggb ! tiovxisp dcc-isp-file=/opt/imaging/imx219/linear/dcc_viss.bin sensor-name=SENSOR_SONY_IMX219_RPI ! video/x-raw, format=NV12 ! tiovxmultiscaler name=multiscaler_split_00 multiscaler_split_00. ! queue ! video/x-raw, width=480, height=416 ! tiovxmultiscaler target=1 ! video/x-raw, width=416, height=416 ! tiovxdlpreproc out-pool-size=4 data-type=3 tensor-format=1 ! application/x-tensor-tiovx ! appsink max-buffers=2 drop=true name=flow0_pre_proc0 multiscaler_split_00. ! queue ! video/x-raw, width=1280, height=720 ! tiovxdlcolorconvert out-pool-size=4 ! video/x-raw, format=RGB ! appsink max-buffers=2 drop=true name=flow0_sensor0";
cv::VideoCapture cap(pipeline, cv::CAP_GSTREAMER);

It gave me this error:

APP: Init ... !!!

MEM: Init ... !!!
MEM: Initialized DMA HEAP (fd=6) !!!
MEM: Init ... Done !!!
IPC: Init ... !!!
IPC: Init ... Done !!!
REMOTE_SERVICE: Init ... !!!
REMOTE_SERVICE: Init ... Done !!!
1766.652335 s: GTC Frequency = 200 MHz
APP: Init ... Done !!!
1766.652435 s: VX_ZONE_INIT:Enabled
1766.652447 s: VX_ZONE_ERROR:Enabled
1766.652456 s: VX_ZONE_WARNING:Enabled
1766.653177 s: VX_ZONE_INIT:[tivxPlatformCreateTargetId:116] Added target MPU-0
1766.653297 s: VX_ZONE_INIT:[tivxPlatformCreateTargetId:116] Added target MPU-1
1766.653394 s: VX_ZONE_INIT:[tivxPlatformCreateTargetId:116] Added target MPU-2
1766.653485 s: VX_ZONE_INIT:[tivxPlatformCreateTargetId:116] Added target MPU-3
1766.653499 s: VX_ZONE_INIT:[tivxInitLocal:136] Initialization Done !!!
1766.653987 s: VX_ZONE_INIT:[tivxHostInitLocal:101] Initialization Done for HOST !!!
[ WARN:0@0.279] global /usr/src/debug/opencv/4.5.5-r0/git/modules/videoio/src/cap_gstreamer.cpp (1226) open OpenCV | GStreamer warning: cannot find appsink in manual pipeline
1766.665441 s: VX_ZONE_ERROR:[vxGetStatus:1020] Reference is NULL
1766.665971 s: VX_ZONE_INIT:[tivxHostDeInitLocal:115] De-Initialization Done for HOST !!!
1766.666658 s: VX_ZONE_INIT:[tivxDeInitLocal:204] De-Initialization Done !!!
APP: Deinit ... !!!
REMOTE_SERVICE: Deinit ... !!!
REMOTE_SERVICE: Deinit ... Done !!!
IPC: Deinit ... !!!
IPC: DeInit ... Done !!!
MEM: Deinit ... !!!
DDR_SHARED_MEM: Alloc's: 0 alloc's of 0 bytes
DDR_SHARED_MEM: Free's : 0 free's of 0 bytes
DDR_SHARED_MEM: Open's : 0 allocs of 0 bytes
MEM: Deinit ... Done !!!
APP: Deinit ... Done !!!
[ WARN:0@0.292] global /usr/src/debug/opencv/4.5.5-r0/git/modules/videoio/src/cap_gstreamer.cpp (862) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created
cannot open camera