VideoCapture(0) stuck on my mac(OSX 10.9.5 Python 2.7 OpenCV 2.4)!

asked 2015-03-10 06:16:05 -0600

mreko gravatar image

updated 2015-03-10 06:27:44 -0600

berak gravatar image

I am doing video streaming by using VideoCapture(0). There are two scripts:main.py(use for get the frame). camera.py(use for return the frame captured by camera) The system is deployed in Flask.
Here is my camera script:
%camera.py
import cv2

class VideoCamera(object):
def __init__(self):
print 'before video success!'
self.video = cv2.VideoCapture(1) *it stuck at this line!
print 'after video success!'
self.video.set(3,320)
self.video.set(4,240)
self.video.set(15, 0.1)

def __del__(self):
self.video.release()

def get_frame(self):

    success, image = self.video.read()
    ret, jpeg = cv2.imencode('.jpg', image)
    return jpeg.tobytes()

There is no error,just print 'before video success!' and stuck at this line!

edit retag flag offensive close merge delete

Comments

I'm having the same problem

giacaglia gravatar imagegiacaglia ( 2015-11-02 23:30:41 -0600 )edit