vietanhdev / open-adas

An open source advanced driver assistance system (ADAS) that uses Jetson Nano as the hardware. Features: Traffic sign detection, Forward collision warning, Lane departure warning.
MIT License
414 stars 123 forks source link

Camera streaming error #13

Closed uyrusali closed 3 years ago

uyrusali commented 3 years ago

Hello,

I succesfully built and installed the project on Jetson TX2.

When I run open-ADAS with:

./OpenADAS  --on_dev_machine

I receive below error:

&&&& RUNNING LaneDetector # 
Loading TensorRT engine file at: models/lane_detection/lane_segmentation_384x384.engine
Using CAN interface vcan0
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (1757) handleMessage OpenCV | GStreamer warning: Embedded video playback halted; module v4l2src0 reported: Internal data stream error.
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (886) open OpenCV | GStreamer warning: unable to start pipeline
[ WARN:0] global /home/nvidia/host/build_opencv/nv_opencv/modules/videoio/src/cap_gstreamer.cpp (480) isPipelinePlaying OpenCV | GStreamer warning: GStreamer: pipeline have not been created

However, the camera works fine when I check if my Logitech USB Camera works OK command:

gst-launch-1.0 -v v4l2src device=/dev/video1 ! video/x-raw,framerate=30/1,width=640,height=480 ! xvimagesink

It looks like open-ADAS tries to grab video from v4l2src0 where I could reach the camera with ID v4l2src

Any idea on how to solve this problem?

Thanks.

vietanhdev commented 3 years ago

You can update your camera id in line 92 of this file: https://github.com/vietanhdev/open-adas/blob/master/src/ui/main_window.cpp. Replace 0 with your camera id.

cv::VideoCapture video;
    if (!video.open(0)) {
        QMessageBox::critical(
            nullptr, "Camera Error",
            "Could not read from camera");
        return;
    }
uyrusali commented 3 years ago

You can update your camera id in line 92 of this file: https://github.com/vietanhdev/open-adas/blob/master/src/ui/main_window.cpp. Replace 0 with your camera id.

cv::VideoCapture video;
    if (!video.open(0)) {
        QMessageBox::critical(
            nullptr, "Camera Error",
            "Could not read from camera");
        return;
    }

Thans for quick response. I replaced 0 with 1 and it worked.

/dev/video0 on Jetson TX2 dev kit corresponds to on-board CSI camera. There might be some additional settings for creating a pipeline and using that camera. However, By replacing 0 with 1 I was able to capture video from USB camera.

vietanhdev commented 3 years ago

You can add another parameter for camera id here: https://github.com/vietanhdev/open-adas/blob/master/src/main.cpp. However, I think the better way is to select the camera based on product id or serial number because the camera id is not a stable number to depend on.

uyrusali commented 3 years ago

Sure, I will look for a better solution for the selection of the camera such as product id or serial number for more stability. Thanks again.