0

I'm trying now to fix this bug for a few days and nothing is going forward.. I want to acces the camera of my Nvidia Jetson Tx2 with OpenCV and GStreamer.

(java:7468): GStreamer-CRITICAL **:gst_element_get_state: assertion 'GST_IS_ELEMENT (element)' failed

 Videocapture cap = new VideoCapture();
cap.open("nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=
(int)720, format=(string)I420, framerate=(fraction)120/1 ! nvvidconv flip-
method=2 ! video/x-raw, format=(string)I420 ! videoconvert ! video/x-raw, format=
(string)BGR ! appsink");
    cap.read(...

This pipeline worked great, but as I started my Jetson a few days ago it gave me this error. Maybe because I updated something... I don't know

Information

  • Nvidia Jetson TX2

  • Ubuntu 16.04

  • OpenCV 3.4.2

  • Java 1.8

  • GStreamer + plugins installed

Tried to rebuild OpenCV but nothing helped

Does anyone know how to solve this problem?

Jin Lee
  • 3,194
  • 12
  • 46
  • 86
Tailor
  • 193
  • 1
  • 12
  • Run `gst-inspect-1.0` and check if all elements you used in that pipeline are listed there. – Florian Zwoch Sep 12 '18 at 17:24
  • Hi, I checked all elements but everything is installed.. Sry I didn't went to stackoverflow since yesterday – Tailor Sep 13 '18 at 05:56
  • Hi, could you share more of your error log. It is better to see which element fails. – Alper Kucukkomurler Sep 13 '18 at 08:44
  • Hey, I already searched for the error log but I didn't found it. Do you know where the error log is? I'm using netbeans btw – Tailor Sep 13 '18 at 08:48
  • one of the elements you are using does not exist. Or maybe there is a typo in the element name in your pipeline. Check all the elements using `gst-inspect` – gst Sep 13 '18 at 09:13
  • I found all elements using gst-inspect-1.0 – Tailor Sep 13 '18 at 09:28
  • You could [activate GStreamer logging](https://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gst-running.html) to find out what is going wrong. – micha137 Sep 27 '18 at 08:27

2 Answers2

0

If you look at pipelines from deepstream samples, on jetson nano they have extra element in pipeline nvegltransform. Its really hard to understand from their documents what it is, but may be you should try it.

Stepan Yakovenko
  • 8,670
  • 28
  • 113
  • 206
0

Here is an example pipeline that worked for me:

cv2.VideoCapture((
  "nvarguscamerasrc ! "
  "video/x-raw(memory:NVMM), "
  "width=(int)%d, height=(int)%d, "
  "format=(string)NV12, framerate=(fraction)%d/1 ! "
  "nvvidconv flip-method=%d ! "
  "video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! "
  "videoconvert ! "
  "video/x-raw, format=(string)BGR ! appsink "
  "wait-on-eos=false drop=true max-buffers=1"
  % (
      capture_width,
      capture_height,
      framerate,
      flip_method,
      display_width,
      display_height,
  )
), cv2.CAP_GSTREAMER)
Saturnin Pugnet
  • 394
  • 2
  • 8