Ask Your Question

La Roja's profile - activity

2020-11-14 15:48:16 -0600 received badge  Popular Question (source)
2014-05-26 08:38:21 -0600 asked a question error: (-215) !_src.empty() in function pyrDown_ ysing python

Hi i'm trying to use cv2.imwrite in order to take snapshots from my webcam and use them later in my program but the function doesn't write any images here is the code that i'm using:

def LeftCap():
cap = cv2.VideoCapture(1)

while(True):
    ret, frame = cap.read()
    cv2.imwrite('imageL.jpg',frame)
    fn = ('/home/sabrine/opencv-2.4.9/samples/python2/imageL.jpg')
    break
print 'Done taking pic from the left cam'
return fn

and then i use the returned path in this code:

def Calculate(Li, Ri, Mat):
img_L = cv2.pyrDown( cv2.imread(Li) )
img_R = cv2.pyrDown( cv2.imread(Ri))

but i'm getting this error:

Traceback (most recent call last):
File "/home/sabrine/opencv-2.4.9/samples/python2/Memo.py", line 323, in <module>
D=Calculate(Li, Ri, Q)
File "/home/sabrine/opencv-2.4.9/samples/python2/Memo.py", line 255, in Calculate
img_L = cv2.pyrDown( cv2.imread(Li) )
error: /home/sabrine/opencv-2.4.9/modules/imgproc/src/pyramids.cpp:194: error: (-215)  !_src.empty() in function pyrDown_

any help i'll be thankful PS:I'm working on Ubuntu