[Pyhon and OpenCV]How to use the camera on TX1

Hi!
First,I’m not good at English,sorry.

I’m trying to use TX1 camera to take a picture.
And I’m using Python code below, but its strange.
Its made an image filled with only black anytime.


[b]#!/usr/bin/env python
import cv2

cap = cv2.VideoCapture(0)

ret, frame = cap.read()
img = cv2.imread(‘capture.jpg’)

cv2.waitKey(10)
path = “test_photo.jpg”
cv2.imwrite(path,frame)

cap.release()[/b]

I checked the camera by command below, and took a snapshot.
So I could check the camera working .


nvgstcapture-1.0 -m 1 --image-res=10

Please tell me how to use TX1 camera by python.
Thanks!

Hi Tare_Nao
Current TX1 VI/CSI camera stack don’t support the python cv2, but I think you can try the USB web cam.