Jason94
Jason94

Reputation: 13610

Im getting a 0 byte image when grabbing a frame from the webcam

I'm trying to make an app that takes images periodically.

So to start it off I thought I could make a app that takes a image and saves it. It saves it allright, but the image is empty... why is this?

import cv

capture = cv.CaptureFromCAM(0)
img = cv.QueryFrame(capture)

foo = cv.SaveImage("foo.jpg", img)

Upvotes: 0

Views: 114

Answers (1)

Fabien R
Fabien R

Reputation: 685

First, I would advise you to test if CaptureFromCAM() succeeded by checking the value of capture. You may also display the flow in a window. Second, you will read in the documentation that there are restrictions using SaveImage().

Upvotes: 1

Related Questions