naisy / realtime_object_detection

Plug and Play Real-Time Object Detection App with Tensorflow and OpenCV. No Bugs No Worries. Enjoy!
MIT License
101 stars 36 forks source link

Issue getting CSI Camera to work #57

Open scbean opened 5 years ago

scbean commented 5 years ago

I am working on a Xavior JP 4.1.1 (although I tried on a TX2 and wasn't able to get to work either, it did display a different error) but I can't seem to get it to see the onboard camera.

Even though I have the config file set to use the TX2 camera it won't. The webcam does work however. the following is what it says:

Traceback (most recent call last):
  File "run_stream.py", line 123, in main
    detection.start(cfg)
  File "/home/nvidia/Downloads/realtime_object_detection-master/lib/detection_nms_v2.py", line 192, in start
    video_reader.start(VIDEO_INPUT, WIDTH, HEIGHT, save_to_file=SAVE_TO_FILE)
  File "/home/nvidia/Downloads/realtime_object_detection-master/lib/webcam.py", line 46, in start
    raise IOError(("Couldn't open video file or webcam."))
OSError: Couldn't open video file or webcam.

I did install: apt-get install libxine2

The command below works to view the camera: nvgstcapture-1.0

Below is the config file, maybe I am making a mistake there?

image_input: 'images'       # input image dir
movie_input: 'input.mp4'    # mp4 or avi. Movie file.
#camera_input: 0            # USB Webcam on PC
#camera_input: 1             # USB Webcam on TX2
### Onboard camera on TX2 ### (need: apt-get install libxine2)
camera_input: "nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720,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"

I feel like it is something with nvcamerasrc but don't really know.

Thanks for any help!

naisy commented 5 years ago

Hi @scbean,

I do not know how to use the TX 2 camera with the OpenCV program on Xavier. It seems that the problem is solved with Xavier Forum, so please refer to that. https://devtalk.nvidia.com/default/topic/1042892/jetson-agx-xavier/nvarguscamerasrc-opencv-solved-/

naisy commented 5 years ago

Hi @scbean,

Now, TX2 camera on Xavier works. Thanks.