Ask Your Question
0

Cannot access camera on Mac Lion System!

asked 2013-09-25 19:33:18 -0600

Hi, I am using python on the Mac Lion system. I built the latest opencv package downloaded from this website with With_V4L = ON. I wrote the simplest code as follows:

import cv2
import cv
import numpy as np
import time

def main():
    capture = cv2.VideoCapture(0)
    print capture.isOpened()
    print capture
    time.sleep(10)
    cv2.namedWindow("Camera")
    capture.set(cv.CV_CAP_PROP_FRAME_WIDTH, 640)
    capture.set(cv.CV_CAP_PROP_FRAME_HEIGHT, 480)

    while (capture.isOpened()):
        ret, image = capture.read() 
        cv2.imshow("Camera",image)
        k = cv2.waitKey(30)
        if k == 27:
            break

if __name__ == "__main__":
    main()

The system keeps popping out this error: File "opencvtest.py", line 31, in <module> main() File "opencvtest.py", line 25, in main cv2.imshow("Camera",image) cv2.error: /Users/conangausslee/Downloads/opencv-2.4.6.1/modules/highgui/src/window.cpp:261: error: (-215) size.width>0 && size.height>0 in function imshow

I have no idea what is going on here. Can Anybody tell me what is the problem?

edit retag flag offensive close merge delete

Comments

nobody can help me with this?

Gauss Lee gravatar imageGauss Lee ( 2013-09-26 12:00:28 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2013-09-27 00:25:06 -0600

icylord gravatar image
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-09-25 19:33:18 -0600

Seen: 469 times

Last updated: Sep 27 '13