PDA

View Full Version : Camera Questions (Unique Project)



robotmaster
06-03-2013, 03:16 PM
Hey everyone,
I have read everything I could find in the forums about cameras, but I am not building a mech warrior. I actually have built battlebots for 10 years now, but I am working on this new project and you are the only robotics guys that know about cameras!

So I am building a robotic snake, hopefully with camera. The issue is the size. I have tried multiple of the "wireless spy cameras" and they work size-wise but the video was miserable. I have attached a picture of the segment for the camera, the dimensions of the space for the camera are 1.8"x1.8" by 2.2" long. After reading the other posts on the forum, it seems your most common webcams wouldn't work, but I was hoping someone might know about a camera that would work for me. Thank you so much your help!

4772
(picture is with 2 AAA batteries for size reference)

tician
06-03-2013, 03:44 PM
I'm using a pair of cheap Microsoft Lifecam HD-3000 USB webcams in a stereo setup. After removing the rubber-coated metal stand, the camera ends up being ~1.75" wide by ~1.5" tall by ~1.25" deep. You can cut it down further by removing the rest of the plastic housing to end up with a PCB and lens ~1.25" wide by ~0.75" tall by ~0.5" deep (depending on how you mount it and route the USB cable). It will require a small pc of some sort with a USB host (RaspberryPi, maybe? although that already has its own camera board).

Only annoying thing so far is that the linux drivers for 12.04 permit each webcam to grab as much bandwidth as it can get its tendrils around, so I've been having trouble getting two to play nice together in OpenCV on a single USB2 controller at any resolution higher than 640x360 (doesn't want to permit MJPG, but 640x480 and larger seems to work fine on Windows). A single camera can easily capture 1280x720 at 15~30 fps. It has a rolling shutter, so there is a bit of horizontal stretching/blurring when the camera moves too quickly, but I am not aware of many inexpensive webcams that actually have the global shutter necessary to prevent that.

jwatte
06-04-2013, 11:07 AM
I also use a LifeCam 3000 for my walking robot.
My rolling robot uses two LifeCam Cinema HD cameras, which are shaped as a inch-wide cylinder about two inches long.

Both of these require hardware with USB to actually capture the data. For a snake form factor, you may want to look into a Raspberry Pi (which I've used on the walker) for this.

I also have the USB bandwidth problem; I had to split the cameras so one goes on the USB2 controller and one in the USB3 controller. If you're only doing one, that shouldn't be a problem. I use MJPEG capture, as it's much better with the bandwidth than raw.

tician
06-04-2013, 04:03 PM
Although I know the HD-3000 is capable of producing MJPEG streams (works fine on Windows), the camera and/or linux drivers refuse to permit its use. It always goes at uncompressed, which greatly cuts down on possible resolution when your netbook/RaspberryPi has only a single USB2 controller. Just got to playing with one of the RaspberryPi in the lab, and while it works pretty well with a single camera for streaming, it is not really capable of doing much more than QQVGA resolution stereo processing using OpenCV's StereoBM and a GUI. Was thinking of putting a RPi and two USB webcams in the head of a DARwIn-OP and have it feed the depth image over ethernet. Might be getting a BBB soon, so that would be another possibility with a bit more speed.

KevinO
06-04-2013, 05:01 PM
I agree with you Tician. I'm not sure if you are following my project and my work with openCV and openNI using a primeSense sensor for depth. It'm basically maxing out the raspberry pi at a 100% CPU doing any object tracking or gesture tracking. That even with the CPU overclocked to 1000Mhz.

tician
06-04-2013, 05:59 PM
I agree with you Tician. I'm not sure if you are following my project and my work with openCV and openNI using a primeSense sensor for depth. It'm basically maxing out the raspberry pi at a 100% CPU doing any object tracking or gesture tracking. That even with the CPU overclocked to 1000Mhz.
Indeed. That is a very impressive project thread. We've got a couple Kinects and an Intel Gesture Cam in the lab, but they are all a little too bulky for (or not supported by the OS on) our legged bots. The USB cams and OpenCV experiments are primarily to be examples for the revamped Machine Vision curriculum, but I would also like to try for RoboCup sometime and they have a prohibition against active sensors.

From what I've seen so far, the RPi does not seem much more impressive than my now dead ultra-portable (2001~2011). I can get the RPi to stream a pair of images at SVGA resolution, but not at a very high framerate or consistently synchronized (one cam always starts lagging ~1 second behind the other). This is at least partly the USB2 controller getting overloaded, but even trying to use nothing other than Code::Blocks causes quite a bit of lag. It's a good thing they are not very expensive...

jwatte
06-04-2013, 07:03 PM
the camera and/or linux drivers refuse to permit its use

That's not true. I use MJPEG from both a HD-3000 and a HD Cinema, into both a Raspberry Pi, a Z-box AD-11, and a mini-itx Intel box.
What it *does* do wrong is calculate maximum bandwidth used. Hence, why you can only use one per USB controller on your motherboard.
My code for reading the MJPEG from the camera is on github:
https://github.com/jwatte/robotcode/blob/master/Onyx/lib/Camera.cpp
That code is not super easy to extract into its own thing, because it's built to be part of a bigger application, but it should illustrate how I do it and it works. Especially configure_dev() and configure_buffers() at the bottom of that file.

tician
06-04-2013, 07:53 PM
That's not true. I use MJPEG from both a HD-3000 and a HD Cinema, into both a Raspberry Pi, a Z-box AD-11, and a mini-itx Intel box.
What it *does* do wrong is calculate maximum bandwidth used. Hence, why you can only use one per USB controller on your motherboard.
My code for reading the MJPEG from the camera is on github:
https://github.com/jwatte/robotcode/blob/master/Onyx/lib/Camera.cpp
That code is not super easy to extract into its own thing, because it's built to be part of a bigger application, but it should illustrate how I do it and it works. Especially configure_dev() and configure_buffers() at the bottom of that file.
I knew that it grabbed as much bandwidth as it could and using the uvcvideo module with quirks=128 permits two to behave together at 640x360, but no higher resolution. It has never presented itself to v4l2-ctl as having anything other than 'YUYV' even though lsusb lists it as having MJPEG compression outputs. Playing around with guvcview just now, I realize that it does actually change framerate (actual and available) when switching between MJPG and YUYV, although the image quality does not change appreciably (threw me a bit). Still really annoying that the camera is so greedy...

robotmaster
06-05-2013, 01:46 PM
I did take apart a webcam today, and the camera board itself is definitely small enough to work here. The only issue is then transmitting the USB signal wirelessly to a computer. I looked at the Raspberry Pi like Jwatte and others were talking about, and it is not small enough to fit inside the snake segment, but definitely a good option if it did. The other thing I was thinking was to send the signal through a Xigbee, but after looking online, those cannot support the bandwidth necessary for a video signal. After more reading, it looks like the bandwidth requirement is too great that even companies who tried to manufacture a wireless USB adapter couldn't make it happen.

I found this wifi cam with a range of 20meters.
http://www.toupo-hk.com/index.php/lifestyle-gadgets/consumer-electronics/mini-wireless-portable-spy-ip-camera.html
But, I think my best option so far is just to go back to the $20 wireless camera with silly tuning knobs...

ArduTank
06-05-2013, 03:14 PM
If you get a good webcam that can fit, look at the Gumstix boards. They'd probably fit

tosjduenfs
06-12-2013, 03:38 AM
Look into the cameras used for FPV piloting of RC airplanes and helicopters. There is a wealth of information on the rcgroups forums.

quantmfizikz
08-11-2013, 12:36 PM
Im using the raspberry pi camera module for my bot. Its the size of a quarter and has HD output in video and picture.