erigr222
Posts: 10
Joined: Tue Apr 30, 2013 8:01 am

Stabilizing video with the RPi

Fri May 03, 2013 8:21 am

Greetings,

Im currently working on a project which involves stabilizing a video stream from a camera mounted on a moving platform. Im planning on using gyroscope as well as the video stream itself to get data. What I fear is that the RPi wont be able to handle the necessary image processing in real time. I've read (somewhat old) posts about getting max 1 - 4 fps with a USB camera and openCV. Has this gotten any better? Even if it hasn't, I would still like to test my approach. What type of Camera would be the optimal choice? Currently, I have a "Point Grey CMLN 13S2M". It might be a bit heavy for my purpose, since I'm planning on doing hardware stabilizing, i.e. physically moving the camera to compensate for angular displacement. This leads to another question regarding the choice of motor. What would be best here?

I'm not asking for a full solution here. Just curious to see if anyone has any experience with this type of project.


/Eric

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

Re: Stabilizing video with the RPi

Fri May 03, 2013 9:00 am

The soon to be released Raspi camera has software video stabilisation, but only updownleftright, not rotational, which I think you will need.

Processing using OpenCV frames from the Raspi camera should be possible - the camera can do 1080p30 but OpenCV won't be able to handle that I don't think.

I'd be inclined to do it all in software and rotate/translate the images - adding a 3 axis mount and interfacing will probably take longer. Unless you use a pure gyroscopic mount (Steadycam?) in which case you don't need any software at all!
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Stabilizing video with the RPi

Fri May 03, 2013 9:52 am

Interesting project - outside what I know about so take what I say with a pinch of salt.

I take it you're not committed to that particular camera yet, but you happen to have that one available?

Assuming you are going to proceed with hardware stabilisation (not software as the raspi camera may be able to support) you'll need three axis rotation on some sort of gimbal, is that right? If so I doubt the weight matters that much, I'd guess the real limit to speed of response would be any moving gubbins you build around the camera; the camera itself would be at the centre and its own inertia would be low.

What we really need is someone to come along who's tried lots of USB webcam experiments on the raspi - what I'd say is there have been a lot of detractors on the forum attacking the raspi's USB performance, you may have read some of those posts first. Alternatively if you're not committed to USB, then as James suggests the fastest way to get frames into the raspi will be by the raspi camera, though bear in mind there will probably be delays in supply!

erigr222
Posts: 10
Joined: Tue Apr 30, 2013 8:01 am

Re: Stabilizing video with the RPi

Fri May 03, 2013 10:44 am

Ravenous wrote:Interesting project - outside what I know about so take what I say with a pinch of salt.

I take it you're not committed to that particular camera yet, but you happen to have that one available?

Assuming you are going to proceed with hardware stabilisation (not software as the raspi camera may be able to support) you'll need three axis rotation on some sort of gimbal, is that right? If so I doubt the weight matters that much, I'd guess the real limit to speed of response would be any moving gubbins you build around the camera; the camera itself would be at the centre and its own inertia would be low.

What we really need is someone to come along who's tried lots of USB webcam experiments on the raspi - what I'd say is there have been a lot of detractors on the forum attacking the raspi's USB performance, you may have read some of those posts first. Alternatively if you're not committed to USB, then as James suggests the fastest way to get frames into the raspi will be by the raspi camera, though bear in mind there will probably be delays in supply!
Thank you for your replies!

Correct, I will probably order a new camera. The problem is that this is a academic project with a specific time frame which means that I won't be able to wait for the Raspi Cam.

Yes, ideally, I would need some sort of gimbal, but as a start I'll focus on the pitch angle => 1 degree of freedom => 1 motor. This shouldn't be very hard to expand to roll and yaw compensation if I have the time.

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: Stabilizing video with the RPi

Fri May 03, 2013 12:01 pm

By the way if you're going to use a servo or similar, these can be a bit jittery - but putting a lever or gear arrangement in, so the total travel is reduced to say 20 or 30 degrees, will probably help a bit. (Should be room for it in the single axis case.)

Yes I (dimly) remember how it is with college projects, unless a tasty piece of hardware already happens to be lying around you're very limited for budget, as well as workshop facilities and time! But you're allowed a few cheats like this to prove the principle.

Return to “Automation, sensing and robotics”