simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

How to emulate this tracking system

Sun May 19, 2013 9:47 pm

I recent;t was given a demo of this
http://www.irisconnect.co.uk/products/c ... covery-kit

where the camera base turns and follows a teacher in the classroom.

The teacher basically wore a dongle around their neck and the camera base turned to follow it.

I'm pretty certain it was IR based as when I covered the dongle over, the camera could track it.

Anyone fancy coming up with a bit of hardware/software to make an RPi do the same -I can do the turntable and motor but not the tracking :)

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

Maxion
Posts: 138
Joined: Mon Dec 03, 2012 2:22 pm

Re: How to emulate this tracking system

Mon May 20, 2013 6:05 am

AFAIK motion can do this?

Would just be a matter of installing it and adding a webcam with pan and tilt.

Or if you want to go fancy you can buy the PiCam and build your own pan/tilt motor assembly and interface it with motion.

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: How to emulate this tracking system

Mon May 20, 2013 6:22 am

What's motion?

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

Maxion
Posts: 138
Joined: Mon Dec 03, 2012 2:22 pm

Re: How to emulate this tracking system

Mon May 20, 2013 6:32 am

Motion is a command line application for linux operating systems that can monitor a video input and determine if motion has occured. It can then do a wide variety of things.

http://www.lavrsen.dk/foswiki/bin/view/Motion

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: How to emulate this tracking system

Mon May 20, 2013 6:51 am

Ta :)

Probably;y not going to be able to track the teacher compared to little Tom swinging on his chair in the front row :)

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

Maxion
Posts: 138
Joined: Mon Dec 03, 2012 2:22 pm

Re: How to emulate this tracking system

Mon May 20, 2013 6:53 am

simplesi wrote:Ta :)

Probably;y not going to be able to track the teacher compared to little Tom swinging on his chair in the front row :)

Simon
AFAIK you can set up masks in motion, so that it'll ignore certain parts of the frame for motion detection.

This way if you've got say 2/3rds of the frame occupied by sitting students and your camera position is fixed (well apart from the tracking) you could quite easily implement a mask that'd only track the teacher who's in the upper third.

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

Re: How to emulate this tracking system

Mon May 20, 2013 8:36 am

simplesi wrote: The teacher basically wore a dongle around their neck and the camera base turned to follow it.
Maybe that's just an infrared beacon and the camera is tracking it.

I think the old Nintendo Wii controllers do the same thing - they have a black window at the front which is a simple infrared sensitive CCD. It can even pick up a burning match. bytheway that means it would automatically track smokers too! :evil:

But this would mean the infrared thingie would appear on the camera with a weird blue glow... unless there's a separate small camera window at the front which does the tracking, and the main recording camera is filtered.

(For an example of what I mean, try using a digitial camera to photograph the front end of an infrared controller while holding down its button. As long as the exposure catches the short IR pulses, the LED will appear a bluish colour. This is a handy way to test IR controllers and stuff.)

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: How to emulate this tracking system

Mon May 20, 2013 1:34 pm

AFAIK you can set up masks in motion, s ... per third.

mm - well that might be worth looking at then - @martinbateman did mention that he was thinking of such a project :)

@ravenous
I think we are looking at a Nintendo type system here (or maybe somehting simpler with just an ir emitter on the teacher and a couple of ir detectors.

This project has got a bit more serious - one of my headteachers is VERY keen to come up with a DIY solution that doesn't loads of money

I've promised him you chaps are the people for the job :)

Simon

PS It might not even need an RPi - maybe an Ardunio/Shrimp could do the job if the IR tracking is simple enough :)
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: How to emulate this tracking system

Mon May 20, 2013 1:48 pm

It sounds very simple to me: if the IR source is to the right, track right. If the IR source is to the left, track left. If you've lost it, track one way and then another until you find it.

There a many failure cases that will make debugging fun. For example the teacher turns their back to the camera and the IR reflects off the corner of the room. It might be worthwhile to use a Pi simply because you can write cleverer algorithms on it easier than on an Arduino.

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

Re: How to emulate this tracking system

Mon May 20, 2013 2:50 pm

simplesi wrote: This project has got a bit more serious - one of my headteachers is VERY keen to come up with a DIY solution that doesn't loads of money
Just your luck - you've attracted a fussy customer. You're about to find out how Liz feels sometimes on this forum :o

Be warned I think this, as I see it, is an advanced DIY project:

The version I described needs two cameras hooked up at once - a normal raspi camera or something, and a low-res webcam or similar with a filter that blocks everything but infra red. Maybe the Wii-style sensor can be used for that (I did notice a few DIYers on the net had used it, though no idea how they bought the sensors). If not it'd be a project in itself to find out how to improvise a suitable tracking camera.

The system needs to be filming with the main camera, while reading frames from the infra red a few times per second to decide if it needs to pan.

The alternative, using Motion, might be tricky... because when the camera pans, everything else in the frame is moving too :) can it be adjusted to handle that? (I have no idea.)

By the way using infra red in say a Chemistry class when there are naked flames (bunsen burners!) might not be possible. Unless the commercial one is a lot more sophisticated than I thought...

A single-camera version would need to be completely different, no tags have to be worn but another way to recognise the target is needed. There have been amateur bits of gear that can do colour tracking for many years - remember the Sony Aibo that used to come with a coloured ball it would "play" with? Or the cmucam. Though making all the teachers wear pink or orange shirts is probably not humane, to them or the kids...

Also bear in mind (especially the infra red approach) it needs to be self calibrating to adjust to room lighting and distance, when switched on, in a way that doesn't stretch the minds of your colleagues. (I said that in the kindest way I could ;) )

I think it will just be cheaper to use two raspi cam setups covering different parts of the class and find a way to record both...

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

Re: How to emulate this tracking system

Mon May 20, 2013 2:54 pm

Oh and I nearly forgot to say, you need to record SOUND as well... :|

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: How to emulate this tracking system

Mon May 20, 2013 3:25 pm

It sounds very simple to me: if the IR source is to the right, track right. If the IR source is to the left, track left. If you've lost it, track one way and then another until you find it.
Is it that simple? Just one IR emiiter, one IR receiver and go for maximum signal? :)

I'll have it done by 8pm then :)
Oh and I nearly forgot to say, you need to record SOUND as well..
:) I'm hoping wireless mike will do that bit - output into USB sound inoput device
You're about to find out how Liz feels sometimes on this forum
If there's one thing I thought I was fully of aware of - its that :eek: (But quick - how will this discussion cause problems!!!!!!!!)

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4258
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: How to emulate this tracking system

Mon May 20, 2013 3:42 pm

Here's another method that would work much better. It does require two devices though, and will only work through 180 degrees. Add a third device for 360.

Use ultrasonics. Have two (or three) receivers at different points in the classroom. Measure the difference in reception time at the two receivers. A little light geometry will give you the angle to the source. It wont be confused by reflection or by the teacher turning away. It will require a calibration sequence, but that should be pretty straightforward to perform, rather harder to program.
simplesi wrote:This project has got a bit more serious - one of my headteachers is VERY keen to come up with a DIY solution that doesn't loads of money
Ah yes; the Engineer's Time Is Free fallacy. Ask him if he can get a supply teacher in while you work on it in school-time. There's a good chance you'd have something usable inside 6 months. ;-)

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

Re: How to emulate this tracking system

Mon May 20, 2013 4:09 pm

Are you allowed to say (indeed do you know) how much the commercial system costs?

Something like this is probably cheap hardware but it'd take someone at least six months (wild guess) to design the thing (in a professional manner and including PCB & case/mechanical designs, etc...)

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: How to emulate this tracking system

Mon May 20, 2013 5:59 pm

Are you allowed to say (indeed do you know) how much the commercial system costs?
Its a few hundred AFAICR (not including IPod) - its not that expensive but its only sold as part of the software which is VERY expensive ( approx 9K for 3 years and then on-going licenseing after that)

The software IS very very good (allows all sorts of video indexing/editing/playback/mixing etc) but no primary can afford that sort of money :)

Anyway - this thread is about the how do we get an RPi with some sort of sensors to track an IR source :) I think and RPi with a camera should be able to do this

Do we need to have an IR cam?
Or hack an Nintendo remote?
Or can we get away with a simpel IR receiver array for £5 :)

Simon
PS - I can do the motor bit BTW - I've some game in that dept :)
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: How to emulate this tracking system

Mon May 20, 2013 8:05 pm

It would also be very handy for RaspberryJam's :)

Just plonk one down and track and record the presenter - maybe even with live streaming built in :)

:)

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

poing
Posts: 1132
Joined: Thu Mar 08, 2012 3:32 pm

Re: How to emulate this tracking system

Mon May 20, 2013 8:31 pm

I've been thinking about something similar for sports. Like you give a player or cyclist or speed skater a device while a battery of PiCameras (possibly with longer lenses) follow that device. Device could be put in a football maybe.

Guess that's a bit harder to make than an IR led, but it would enable some nice things for amature sporters and clubs.

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: How to emulate this tracking system

Tue May 21, 2013 9:43 am

I'm just asking here BTW - just trying to find out as don't want to spend time duplicating others work when I know that others could do this sort of thing better and quicker.

Is anyone going to try and make a IR tracking system to turn a RPi with a camera on a turntable into one? :)

To be absolutely plain - this is just trying to see if anyone's going to to give it a go :)

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

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

Re: How to emulate this tracking system

Tue May 21, 2013 11:41 am

Short answer, not in my case. Too many half built robots, circuits, shelves, telescopes, etc. littering my floor.

Longer answer, here's someone who did an arduino based one:

http://www.instructables.com/id/Wii-Rem ... mera-Hack/

Step 6 shows his video if it moving a servo to track an IR LED. Too fast, but it works.

Step 5 shows his Arduino code. It needs some extra arduino libraries, also linked in the article. Lots of reading on the other pages...

It's not clear to me on a quick read exactly what the wii sensor itself is doing, or why he needs to build a separate i2c board, but apparently the sensor detects up to four IR spots and sends you the coordinates. "It should just work" as the saying goes.

Over they years I've seen bits and bobs where people have got useful information out of the wii controller without even dismantling it, via bluetooth I think. Might have been just reading the accelerometers & tilt though; no idea if it's possible to track the infrared position that way. I don't fancy soldering to that tiny camera.

The way I think I would do this is to have the wii sensor mounted with the camera, on a pan and tilt head using geared motors (or maybe servos). So the whole thing swivels, camera and sensor together. Then get the X and Y position of the infra red spot out of the sensor (hopefully nobody is trying to jam it with infra red gadgets or lighters!), and keep moving the motors (preferably with a smooth PID loop, which is a bit of maths) until the spot is in the middle. It sounds so easy...

EDIT: In the above link he needs the separate i2c thing just to match the levels, because the arduino uses 5V logic and the sensor itself 3.3V. The raspi would connect directly I think...

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: How to emulate this tracking system

Tue May 21, 2013 9:02 pm

Do we need an IR camera just to measure angle difference between where sensor is pointing and where ir emitter is?

Would we not just get away with measuring analog voltage from 2 sensors and then turning to minimise the diff between them?

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

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

Re: How to emulate this tracking system

Wed May 22, 2013 11:12 am

Well using a pair of IR diodes might work, but they'd give an average infrared reading and might not track precisely on a source.

What I'm thinking is, if the window is over to the left hand side of the class and the sun comes out for a few minutes, there's a bit more IR there so the camera will drift a little bit to the left, then go back later. Or the same thing might happen with certain light sources... (I have an IR receiver on something I was building at home. Recently I've noticed it often misses commands, now I have energy-saving bulbs in the living room... using the desk lamp alone seems better...)

techpaul
Posts: 1512
Joined: Sat Jul 14, 2012 6:40 pm
Location: Reading, UK
Contact: Website

Re: How to emulate this tracking system

Wed May 22, 2013 8:34 pm

simplesi wrote:Do we need an IR camera just to measure angle difference between where sensor is pointing and where ir emitter is?

Would we not just get away with measuring analog voltage from 2 sensors and then turning to minimise the diff between them?

Simon
You probably need a few pairs, each pair to average that direction and like a line follower get differences between other pairs for direction (sort of field strength).

With IR it is often better to have a pulsed transmitter so you can sample when no transmission for background level of IR in each direction and have the transmitter send some form of pulsed signal, whether that be a UART character, frequency or code like remote control. That way you can be sure what you are receiving is the right signal.

I am reminded of a robotics professor who made a follow me robot based on IR system he used on a half marathon, at first turn in course robot carried straight on towards the sun :lol:
Just another techie on the net - For GPIO boards see http:///www.facebook.com/pcservicesreading
or http://www.pcserviceselectronics.co.uk/pi/

fuffkin
Posts: 92
Joined: Thu Mar 07, 2013 10:50 pm
Location: United Kingdom
Contact: Website

Re: How to emulate this tracking system

Wed May 29, 2013 6:06 pm

Using IR LED's is a common way of doing tracking. If setup right, LED can appear as a bright speck in the image and that can allow you to use simple, fast processing to extract location data.

Most cameras are very sensitive to IR, but unfortunately they have IR cut filters over the chip. They do retain some residual sensitivity even after the filter - look at an IR remote control with your phone / digital camera and see what I mean.

Instead of using the "normal" IR diodes i.e. around 950nm which is invisible to the naked eye, use near IR around 850nm or less which will appear deep cherry red and will have improved sensitivity for the camera.

Another method is to remove the IR filter - see blog post for how to do this to the RPi camera and then use a bandpass IR filter around the wavelength of the LED. Your goal is to setup the LED to be significantly brighter than anything in the background.

The LED should appear as a bright spot in the image. If you are using a camera with an IRIS that you can adjust, then stop this down so that you block out as much other light as possible and turn off any autogain.

Processing-wise you should be able to use something like OpenCV and the most basic of threshold / auto-threshold algorithms. These are extremely fast algorithms that create binary images i.e black and single white dot. Then use blob detection (and size filtering if you do get noise) to get the XY location of the LED. Again these are very fast algorithms and should fly even on the limited processing of the Raspberry Pi.

For the XY of the "Target" you can calculate the motor control signals...... :D
Sleepy Pi - Extend RPi battery life with a plugin Power Management & Arduino I/O board
http://www.spellfoundry.com

simplesi
Posts: 2327
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
Contact: Website

Re: How to emulate this tracking system

Mon Jun 17, 2013 11:02 am

Well, this has become an "official" summer hols project for me = I've told the head that it'll cost £100 for bits but lets see if I can do it with a model A, a cheap webcam and 1 £2 stepper motor first :)

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter

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

Re: How to emulate this tracking system

Mon Jun 17, 2013 11:34 am

Nothink like a threatened sacking from the boss to motivate...

Do you think you'll be using the webcam to detect the IR pendant, or is the webcam for filming and you're detecting with the photodiode idea?

Return to “Automation, sensing and robotics”