1

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[]

March Ho
  • 649
  • 5
  • 15

2 Answers2

1

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.

March Ho
  • 649
  • 5
  • 15
0

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]
bill s
  • 68,936
  • 4
  • 101
  • 191