1
$\begingroup$

On Mathematica 9.0.1.0, Windows 7 SP1

Calling CurrentImage[] returns a black image, with a few non-black pixels near the top of the image, which may be some kind of debug information. The webcam indicator LED does not turn on during the process (it turns on correctly when using a program such as Skype). The nonzero image values returned using ImageData are listed below: The rest of the image consists completely of {0.,0.,0.}

{0., 0., 0.0156863}, {0.796078, 0.843137, 0.}, {0.564706, 0., \
0.00784314}, {0.00784314, 0.0705882, 0.}, {0.0705882, 0.435294, \
0.909804}, {0., 0.219608, 0.00784314}, {0.219608, 0., 0.188235}, {0., \
0.188235, 0.}, {0.192157, 0.941176, 0.}, {0.0627451, 0., 0.}, {0., \
0., 0.054902}

enter image description here

$ImagingDevices correctly returns

{"Logitech Webcam C100"}

-edit-

I managed to solve the issue, see the self-answer below for details. I will accept as an answer the best answer which explains the origin of the non-black pixels in the data returned by CurrentImage[]

$\endgroup$
1
  • $\begingroup$ FWIW no problem on OS X $\endgroup$ Commented Jan 25, 2015 at 5:19

2 Answers 2

1
$\begingroup$

After some searching, this answer's undocumented function solved the problem.

To turn the camera off you could use the undocumented function IMAQ`StopCamera[]. Similarly IMAQ`StartCamera[] will turn it back on again.

IMAQ`StartCamera[]
CurrentImage[]
IMAQ`StopCamera[]

correctly captured an image as expected.

$\endgroup$
0
$\begingroup$

First open the device:

dev = DeviceOpen["Camera", $ImagingDevice]

then

CurrentImage[] 

works as expected. You'll probably want to close the device when you are done.

DeviceClose[dev]
$\endgroup$
2
  • $\begingroup$ Nope, does't work. It still returns the same (non-image). $\endgroup$
    – March Ho
    Commented Jan 24, 2015 at 20:53
  • $\begingroup$ dev = DeviceOpen["Camera", $ImagingDevices[[1]]] CurrentImage[] doesn't work either. $\endgroup$
    – March Ho
    Commented Jan 24, 2015 at 20:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.