2

I'm running a Ubuntu 14.04 LTS on my RPi 2. I've OpenCV 2.4.9 installed on it. While running a simple camera capture program works fine.

Here is a code for it.

import numpy as np
import cv2
from time import time

cap = cv2.VideoCapture(0)
cap2 = cv2.VideoCapture(1)
frame_count = 0
while(True):
    # Capture frame-by-frame
    start_t = time()
    ret, frame = cap.read()
    #ret2, frame2 = cap2.read()
    end_t = time()
    time_diff = (end_t - start_t)
    print 'Diff is : %f ms\n' % (time_diff * 1000)

cap.release()
cap2.release()
cv2.destroyAllWindows()

But if I remove comments from the line #ret2, frame2 = cap2.read() to enable getting feeds from the other camera, it takes a lot of time to capture a frame (10 sec or something). Has anyone faced similar problem ? I tested the same program on my ubuntu 15.04 laptop. It works fine on my laptop.

Additional info :

Output of lsusb.

Bus 001 Device 006: ID 046d:0825 Logitech, Inc. Webcam C270
Bus 001 Device 005: ID 046d:082b Logitech, Inc. 
Bus 001 Device 004: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN Adapter
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Also, sometimes I get this error when I dig in /var/log/syslog It's not regular though.

ubuntu kernel: [  952.746104] uvcvideo: Failed to resubmit video URB (-1).

Update :

While forcing webcam resolutions to 320x240 by

cap.set(3, 320);
cap.set(4, 240);
cap2.set(3, 320);
cap2.set(4, 240); 

It works fine. Does it have anything to do with v4l2 or something ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.