Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Thanks a lot. That cleared up something. The following code will take a snapshot with the web cam and save it in the directory of the code:

import cv2.cv as cv import time

cv.NamedWindow("camera", 1)

capture = cv.CaptureFromCAM(0)

while True: img = cv.QueryFrame(capture) # cv.ShowImage("camera", img)

cv.SaveImage('test1.jpg', img)

if cv.WaitKey(10) == 27:
    break

cv.DestroyAllWindows()

click to hide/show revision 2
No.2 Revision

Thanks a lot. That cleared up something. The following code will take a snapshot with the web cam and save it in the directory of the code:

import cv2.cv as cv
import time

time cv.NamedWindow("camera", 1)

cv.NamedWindow("camera", 1)

capture = cv.CaptureFromCAM(0)

cv.CaptureFromCAM(0)

while True: img = cv.QueryFrame(capture) # cv.ShowImage("camera", img)

img)
 cv.SaveImage('test1.jpg', img)
 if cv.WaitKey(10) == 27:
 break
cv.DestroyAllWindows()

cv.DestroyAllWindows()

click to hide/show revision 3
No.3 Revision

Thanks a lot. That cleared up something. The following code will take a snapshot with the web cam and save it in the directory of the code:

import cv2.cv as cv
import time

cv.NamedWindow("camera", 1)
 capture = cv.CaptureFromCAM(0)

while True:
    img = cv.QueryFrame(capture)
    # cv.ShowImage("camera", img)

    cv.SaveImage('test1.jpg', img)

    if cv.WaitKey(10) == 27:
        break
cv.DestroyAllWindows()