Failed to get second frame from a CSI camera module
Hi!
On my system: Dragonboard 410c + Linaro Linux 19.01 + 96Boards MIPI Adapter with Dual OV5645 ( https://www.ebay.com/itm/96Boards-MIP...)
I tried to use
cv::VideoCapture cap(pipeline, cv::CAP_GSTREAMER);
to capture frames from one OV5645 image sensor using the following pipeline:
v4l2src device=/dev/video0 num-buffers=1 ! video/x-raw,format=UYVY,width=1920,height=1080 ! videoconvert ! appsink
In a loop of the code, it first gets a frame from OV5645,
cap.read(img)
shows it in a window, waits until the user hit a key, then starts the next iteration of the loop.
The loop can get and show the first frame successfully, but it always fails to get the second frame (the cap.read() function will fail). Here is the code: https://gist.github.com/oliverjungen/...
If this loop is changed to:
open the pipeline
read frame
show image and wait until user hit a key
release the pipeline (cap.release();) and go back to 1.
Then frames can be captured one by one successfully.
How should I use the VideoCapture class to capture a series of frames without release the pipeline after retrieving every frame?