Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error could not find a writer....

import cv2

0 is refrencing first camera

camera = cv2.VideoCapture(0)

range is repeating the indented code by whatever is in ()

for i in range(2): return_value, img = camera.read() cv2.imshow('opencv'+str(i)+'png',img) cv2.imwrite('opencv'+str(i)+'png',img) cv2.waitKey() del camera

It keeps telling me " error: (-2) could not find a writer for the specified extension in function cv:: imwrite_"

Any ideas why?

click to hide/show revision 2
No.2 Revision

updated 2016-11-29 10:25:18 -0600

berak gravatar image

Error could not find a writer....

import cv2
cv2

# 0 is refrencing first camera

camera camera = cv2.VideoCapture(0)

cv2.VideoCapture(0)

# range is repeating the indented code by whatever is in ()

() for i in range(2): return_value, img = camera.read() cv2.imshow('opencv'+str(i)+'png',img) cv2.imwrite('opencv'+str(i)+'png',img) cv2.waitKey() del camera

camera

It keeps telling me " error: (-2) could not find a writer for the specified extension in function cv:: imwrite_"

Any ideas why?

click to hide/show revision 3
No.3 Revision

updated 2016-11-29 10:26:24 -0600

berak gravatar image

Error could not find a writer....

import cv2 

# 0 is refrencing first camera
camera = cv2.VideoCapture(0)

# range is repeating the indented code by whatever is in ()
for i in range(2):
    return_value, img = camera.read()
    cv2.imshow('opencv'+str(i)+'png',img)
    cv2.imwrite('opencv'+str(i)+'png',img)
cv2.waitKey()
del camera

It keeps telling me " error: (-2) could not find a writer for the specified extension in function cv:: imwrite_"

Any ideas why?