Using Single Shot Detector (SSD) with a MIPI (leopard imaging) camera on a TX1

Here is what I have so far:

  1. Removed Opencv4tegra
  2. Installed Opencv 3.1 on TX1 (Had problem installing Caffe with 3.2, hence 3.1!)
  3. Got the image grabber working with opencv (python). Here is the VideoCapture input:

cap = cv2.VideoCapture(“nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)192, height=(int)1080,format-(string)I420,framerate=(fraction)30/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink”)

  1. Installed SSD

Now, how do I input the device ID to ssd_pascal_webcam.py?

Any leads will be appreciated. Thanks in advance!

Hi,

Could you try to open camera with python first?

By the way, it should be ‘width=(int)1920’.

I am able to open it in python. It does give some warning though:

(python:3831): GStreamer-CRITICAL **: gst_element_get_static_pad: assertion ‘GST_IS_ELEMENT (element)’ failed

(python:3831): GStreamer-CRITICAL **: gst_pad_get_current_caps: assertion ‘GST_IS_PAD (pad)’ failed

(python:3831): GStreamer-CRITICAL **: gst_caps_get_structure: assertion ‘GST_IS_CAPS (caps)’ failed

(python:3831): GStreamer-CRITICAL **: gst_structure_get_int: assertion ‘structure != NULL’ failed

(python:3831): GStreamer-CRITICAL **: gst_structure_get_int: assertion ‘structure != NULL’ failed

(python:3831): GStreamer-CRITICAL **: gst_structure_get_fraction: assertion ‘structure != NULL’ failed

Available Sensor modes :
3840 x 2160 FR=60.000000 CF=0xf09208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
1920 x 1080 FR=60.000000 CF=0xf09208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10
1280 x 540 FR=240.000000 CF=0xf09208a10 SensorModeType=4 CSIPixelBitDepth=10 DynPixelBitDepth=10

Here is the script:

import sys
import cv2

def read_cam():
cap = cv2.VideoCapture(“nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,format-(string)I420,framerate=(fraction)30/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink”)
flag, frame = cap.read()
print flag
if cap.isOpened():
cv2.namedWindow(“demo_test”, cv2.WINDOW_AUTOSIZE)
while True:
ret_val, img=cap.read();
cv2.imshow(‘demo_test’,img)
cv2.waitKey(10)
else:
print “camera open fail”

cv2.destroyAllWindows()

if name == ‘main’:
# print cv2.version
read_cam()

Hi,

Are you using webcam or onboard-camera?
The command in #3 is for onboard-camera.

https://www.leopardimaging.com/LI-TX1-KIT-IMX274M12.html
Using a Leopard imaging camera with MIPI interface

Hi,

From this script:

SSD support web-cam not on-board camera.

You need to modify this python script for nvcamerasrc to enable on-board camera.

I shared a python script which could do real-time SSD object detection with either JTX2/JTX1 on-board camera, USB webcam or IP CAM. I think the code could be easily adapted to work for Leopard imaging or other kinds of cameras.

Please refer to the following blog post.

https://jkjung-avt.github.io/camera-ssd-threaded/