mikey32094
Posts: 38
Joined: Sat Jul 25, 2015 10:07 am

Benefits of PI Camera?

Tue Jul 28, 2015 9:43 am

Hey all,

Can someone please explain to me the main benefits of using the PI's special camera, and/or the pitfalls of using a standard USB camera?

I don't need a camera for good image quality or anything. I just need something that will relay a low-fi image back to me for the purposes of piloting a robot, and for feeding a neural network when I try to make it go autonomous later.

The language I'm most comfortable in right now (at least where this type of application is concerned) is Java... so my main concern is whether or not I'll be able to access cam frames quickly and efficiently. 10-20fps would be sufficient at a lower resolution (say 360p) for both piloting and NN projects.

So ... does the dedicated Pi cam provide better/faster ways of accessing pixel data (or frame dumps) to Java? Some special API, perhaps? or am I going to have to do it the usual way with all that openCV stuff? Are there major problems I should expect if just going with some ultra cheapy usb webcam?

This is my first time venturing out into actual hardware. So excited to see what madness I can program into my little PI bot. Thank you all for your time.

tpylkko
Posts: 384
Joined: Tue Oct 14, 2014 5:21 pm

Re: Benefits of PI Camera?

Tue Jul 28, 2015 9:52 am

it's is generally considered polite to search first then ask
viewtopic.php?t=85899&p=607023

ShiftPlusOne
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6162
Joined: Fri Jul 29, 2011 5:36 pm
Location: The unfashionable end of the western spiral arm of the Galaxy

Re: Benefits of PI Camera?

Tue Jul 28, 2015 10:08 am

The official camera is guaranteed to work and not hog the CPU. With USB cameras, it might work the way you need it to, or it might not. People are less likely to be willing to help if you run into trouble with a random camera.

mikey32094
Posts: 38
Joined: Sat Jul 25, 2015 10:07 am

Re: Benefits of PI Camera?

Tue Jul 28, 2015 10:14 am

Okay thanks guys. I think I'm sold on just the GPU/load aspect of it.

When I do get one, would I have to access frames/pixels the normal (ie: hard haha) way via Java, or does it have some special API to make things a bit easier?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 24912
Joined: Sat Jul 30, 2011 7:41 pm

Re: Benefits of PI Camera?

Tue Jul 28, 2015 3:54 pm

mikey32094 wrote:Okay thanks guys. I think I'm sold on just the GPU/load aspect of it.

When I do get one, would I have to access frames/pixels the normal (ie: hard haha) way via Java, or does it have some special API to make things a bit easier?
There is example C code, and also a very good Python library. Or you can use the V4L2 driver which gives it a standard interface.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
“I own the world’s worst thesaurus. Not only is it awful, it’s awful."

User avatar
experix
Posts: 204
Joined: Mon Nov 10, 2014 7:39 pm
Location: Coquille OR
Contact: Website

Re: Benefits of PI Camera?

Tue Jul 28, 2015 3:58 pm

From the postings about getting maximum stills per second, it doesn't appear to me that the RPi camera has any advantage over a USB webcam. I have demos using USB webcam with my data acquisition / display / analysis program, experix, operating it with v4l, in book/pictures and dist/source/xpx_local in the download section at http://experix.sourceforge.net. I have not yet figured out how to use the RPi camera with my program but that may be because I am trying to comprehend the MMAL interface instead of using the v4l adaptation that is available.

6by9
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 7879
Joined: Wed Dec 04, 2013 11:27 am
Location: ZZ9 Plural Z Alpha, aka just outside Cambridge.

Re: Benefits of PI Camera?

Tue Jul 28, 2015 4:13 pm

experix wrote:From the postings about getting maximum stills per second, it doesn't appear to me that the RPi camera has any advantage over a USB webcam. I have demos using USB webcam with my data acquisition / display / analysis program, experix, operating it with v4l, in book/pictures and dist/source/xpx_local in the download section at http://experix.sourceforge.net. I have not yet figured out how to use the RPi camera with my program but that may be because I am trying to comprehend the MMAL interface instead of using the v4l adaptation that is available.
If you have it working with a USB webcam and V4L2, then just

Code: Select all

sudo modprobe bcm2835-v4l2
and your code should work against the Pi camera.

The only quirk is that there is a higher quality processing path designed for stills that is selected by default for raw pixel formats above 1280x720. If you want higher framerate above that resolution then you need to add "max_video_width=2592 max_video_height=1944" to the modprobe line, and lose about another 20MB (rough guess) of GPU memory.
Software Engineer at Raspberry Pi Trading. Views expressed are still personal views.
I'm not interested in doing contracts for bespoke functionality - please don't ask.

User avatar
experix
Posts: 204
Joined: Mon Nov 10, 2014 7:39 pm
Location: Coquille OR
Contact: Website

Re: Benefits of PI Camera?

Tue Jul 28, 2015 8:25 pm

Thanks, 6by9, I'll try that tomorrow, since I feel like I'm getting the upper hand on a major lab cleanup that has been occupying my time.

Return to “Camera board”