Something went quit wrong when I tried to open my cam by index 0
. Of course I’ve plugged in my MIPI CSI cam. I’ve compiled the darknet with opencv, everything worked fine with USB cam, however it was not able to meet our needs with 30 fps on object detection.
I’ve installed gstreamer, opencv 3.4.5, cuda 10 and cudnn.
Is there something missing on my OS, or the MIPI CSI cam needs additional driver to function ?
I’d appreciate it if anyone can help me.
#include<opencv2/opencv.hpp>
using namespace cv;
int main()
{
Mat frame;
VideoCapture cap;
cap.open(0);
if(!cap.isOpened())
return 0;
while(1)
{
cap >> frame;
if(frame.empty())
break;
imshow("cam", frame);
waitKey(20);
}
cap.release();
I do compiled it :
g++ camread.cpp -o camread pkg-config --cflags --libs opencv
And when I tried to run it :
(camread:9086): GStreamer-CRITICAL **: 18:49:28.446: gst_element_get_state: assertion ‘GST_IS_ELEMENT (element)’ failed
VIDEOIO ERROR: V4L: can’t open camera by index 0
I’ve also tried a raspberry pi CSI camera, it didn’t work as well.
Everything worked fine with USB cam.
When I tried
v4l2-ctl --all
terminal showed:
bash: v4l2-ctl: command not found
I’m new to Jetson nano and opencv, so forgive me if there’s anything I ignored.
Thanks alanz and JerryChang. I’ve decided not to use CSI camera and turned to a USB camera instead.
And I’ve installed V4L-utils successfully. Here’s my output by using the command below
I tried with the same code on my Nano board with IMX219 MIPI CSI camera. It works well.
Maybe you can check with dmesg to if there are some driver error with your sensor.
jetbot@jetbot:~$ vim cvtest.cpp
jetbot@jetbot:~$ g++ -o test cvtest.cpp `pkg-config --cflags --libs opencv`
jetbot@jetbot:~$ export DISPLAY=:0
jetbot@jetbot:~$ ./test
GST_ARGUS: Creating output stream
CONSUMER: Waiting until producer is connected...
GST_ARGUS: Available Sensor modes :
GST_ARGUS: 3280 x 2464 FR = 21.000000 fps Duration = 47619048 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: 3280 x 1848 FR = 28.000001 fps Duration = 35714284 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: 1280 x 720 FR = 59.999999 fps Duration = 16666667 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: 1280 x 720 FR = 120.000005 fps Duration = 8333333 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
GST_ARGUS: Running with following settings:
Camera index = 0
Camera mode = 2
Output Stream W = 1920 H = 1080
seconds to Run = 0
Frame Rate = 29.999999
GST_ARGUS: PowerService: requested_clock_Hz=13608000
GST_ARGUS: Setup Complete, Starting captures for 0 seconds
GST_ARGUS: Starting repeat capture requests.
CONSUMER: Producer has connected; continuing.
Hi,
Please guide me how i check if my MYPI camera detected and required drivers installed in linux.? Please confirm if /dev/video* listed means MIPI Camera driver installed and working. what are the required drivers to be installed.
Thanking you,
With Regards