0

I am trying to access a camera (external: leopard imaging mipi) with opencv on TX1 using the following script (tx1_mipi.py). I am able to access it when I run "sudo python tx1_mipi.py". (It does gives an error "VIDEOIO ERROR: V4L: appsink: Unable to query number of channel", but it works)

However, I am not able to run python tx1_mipi.py (camera open fail) . How do I change the permission of the camera so that I don't have to sudo...

I have already tried adding user to video group (gpasswd -a sidmeister video)

ls -l /dev/video0 crw-rw----+ 1 root video 81, 0 Jul 6 14:45 /dev/video0

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")
if cap.isOpened():
cv2.namedWindow("demo", cv2.WINDOW_AUTOSIZE)
while True:
ret_val, img = cap.read();
cv2.imshow('demo',img)
cv2.waitKey(10)
else:
print "camera open failed"


cv2.destroyAllWindows()

if name == 'main': read_cam()
Priya Narayanan
  • 1,197
  • 2
  • 10
  • 16
  • Your title is confusing me. There exists a `pip` package `opencv-python` which does *not* have GUI support on macOS or Linus, but you wrote `python-opencv` so I'm not sure if that was an attempt to tag or if you just switched them and you are using that package. – alkasm Jul 06 '17 at 22:21
  • @Alexander Reynolds Sorry for the confusion. All I meant was I am using opencv with python scripting – Priya Narayanan Jul 07 '17 at 13:06

0 Answers0