I've a BeagleBone running Ångström Linux 3.2.28, and I'm trying to capture a frame from my camera.
So I plug in my USB webcam, and check /dev
to ensure it shows up.
It does, as video0
(bottom right). I know this is correct, because it disappears after I've unplugged the camera.
So now I fire up Python and run the following:
root@beaglebone:/dev# python
Python 2.7.2 (default, Sep 11 2012, 16:15:43)
[GCC 4.5.4 20120305 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv
>>> capture=cv.CaptureFromCAM(-1)
>>> img=cv.QueryFrame(capture)
>>> type(capture)
<type 'cv2.Capture'>
>>> type(img)
<type 'NoneType'>
As you can see, I am able to create the capture object sufficiently, but I am unable to pull a frame from it. I have also tried this with different (or no) integer arguments for the camera ID (the -1
in the code above) to no avail.
For reference, running the same code on my laptop in IPython looks like this:
In [1]: import cv
In [2]: capture=cv.CaptureFromCAM(-1)
In [3]: img=cv.QueryFrame(capture)
In [4]: type(capture)
Out[4]: cv2.Capture
In [5]: type(img)
Out[5]: cv2.cv.iplimage
You can see that here I am indeed capturing an image. I am not sure exactly where to go from here.
UPDATE:
I've played around a bit with FFmpeg and am able to get the camera to respond (that is, its light goes on) by issuing the following command:
root@beaglebone:/# ffmpeg -f video4linux2 -i /dev/video0
Which is interesting because apparently CaptureFromCAM
uses the V4L interface... I am not sure where to go from here.
I am not sure whether this can be an answer. Do try out the following.
I guess, the camera driver is not supported. Connect the camera onto the board and type 'dmesg' in the terminal, and see whether the camera manufacturers name is detected in it.
If the manufacturers name is not present anywhere in the message, the camera driver is to be installed from the terminal:
If the above steps doesn't help you, try installing VLC media player or any other player which supports video input from a camera, and try whether it's working. :)