Definitely I'm a big fan of people sharing and improving each other's codes. Can files be sent over PMs or would I need to email you? There will be a website going up soon with all of the codes on it. I'll link when it's up.

It's typical with school projects, since you use the school's resources. Most schools should have some process available if you want to market the idea or turn it into a company or whatnot, but otherwise it is their property.

If I sold it there would be intellectual property agreement violations, but since there's no money involved nobody will care. If I did try to make a consumer product (which I don't think I will because making this is a lot of work) I would have to split the income with Penn State, those bastards.

If you're an undergrad, then you own the IP (unless you signed a document at the beginning of the project with a company that was sponsoring the project). If you're a grad student, it's trickier, but I wouldn't worry in this case. Feel free to share the code.

As much as I agree with you it's not an argument you'll win. Mainly because there are bronies into that and it is a weird subreddit that's bound to be mentioned often. It annoys me that it exists and that for many people that's the first impression they get of the fandom, but there's not much we can do.

Matlab is an extremely powerful engineering software with almost every algorithm you can think of already implemented on it. The image processing toolbox is well developed and efficient, and already has the functions used in this example (face/body recognition). It really takes only a few lines of code to get it up and running. There is nothing wrong with Matlab or OP's work, it's just that it makes this project a lot less interesting, because it uses a lot of very high level well-known functions/products like Arduino and Matlab.

Using Matlab for image processing is actually pretty efficient. The Arduino simply acts as the interface between the device and the computer. As an engineering student, he was probably taught Matlab and not much else, but for someone who doesn't have the time to develop (or the money to buy) an extensive graphics package, your choices are fairly limited. My approach would have been Python and NumPy, since you get essentially the same functionality as Matlab, but its all free, and I learned Python before learning Matlab

that's where he lost me, where it became a purely academic exercise. I mean, to be fair, I was forced to use matlab as well, and it's slow-ass convolution matching garbage to do pattern-matching in image processing. (In published research, no less!) When you only know one thing, you are forced to use it. But gah, profs should teach kids more realistic/useful methods.

Using C++ instead of matlab would give it quite a boost, getting raw access to the webcam frames in Windows 7 is quite easy; and since this is tracking a color, not identifying the object by its characteristics, my guess is the algorithm isn't complicated enough to require matlab magic.

Is quite an amazing project, he put a lot of attention to the small details.

I'm not too sure the AVR's that the audrino use have the right silicon for it. Maybe some of the media specific AVR's would have enough processing power. It can be pretty processor intensive to read vga at 30fps if you dont have any multimedia hardware

Why 30fps, the servos probably couldn't respond in that time anyway, that could be down to 3fps (given the right webcam or a stable enough serial speed). Plus, since it's just looking for a colour VGA is way overkill. The audrino would then just need to run a algorithm looking for a box of the colour...

But to do anything cooler than looking for colour you'd need...more stuff.

It's a programming limitation. To make color identification easier I have to convert the camera image to LAB﻿ space which takes a surprising amount of time. I'm changing it in V2 to used RGB space and background subtraction so it will hopefully be faster.

The update cycle is mostly a coding limitation. I'm a Mech Eng, not Electrical or Computer so writing code isn't my best skill but I feel like I did well for doing this all in a week haha.

Without going into too much detail, the camera reads the image in RGB color space. I convert it to LAB color space because it makes the color identification easier, but the conversion takes a long time, slowing down each loop. I did a few things to help the speed it up but on my next iteration I'm going to use RGB color space and background subtraction for my object identification.

As for inclination, it's all based on basic trig. More or less the servos should point at the center of the pink object. I made some tweaks to make it aim down a little so it doesn't shoot over my head though.

I work with MATLAB quite frequently since university. You should check out embedded S functions which could take some C++ or other language and integrate into your model. Simple as identifying inputs and outputs of the function. (http://www.mathworks.com/help/toolbox/simulink/sfg/f6-151.html)
Any matlab function you are running in script can be integrated into a Simulink model running as a block of code. Other observations is that you clearly have a latency of processing inherent in the system from processing the iterations of color recognition. Think about some predictive filters or try to model that latency as a block in a simulink model. Even better check out some Kalman filtering to clean up some information gathering and check out some open source Kinect hacks and use that as your sensor. The Kinect is amazing in terms of depth recognition and tracking and your data set will be much more precise. In addition you could also model a targeting block to incorporate a basic dynamic ballistic model of the "dart" with the new-found depth, range, and movement data set. Think about averaging the limits of the target to track center mass and such.

-Your friendly ex-defense contractor specialized in discrete time fire and flight control systems

Could part of the jerky movement also be due to the servos you use? Or do they have uniform .. torque curvesterm? ? I remember having real problems smoothing out the movement of windscreen wiper motors (which have impressive torque and are so slow that they can be pulsed precisely with a simple motor bridge, but are jerky as a result). Or is it just the matlab? I barely use matlab, and I have found it to be a bit slow, but my computer is old and I thought that were the reason.

Yeah I did. The lag is all in the image processing. I left this for someone else too, but...

Without going into too much detail, the camera reads the image in RGB color space. I convert it to LAB color space because it makes the color identification easier, but the conversion takes a long time, slowing down each loop. I did a few things to help the speed it up but on my next iteration I'm going to use RGB color space and background subtraction for my object identification.

This is amazing! Just a thought but maybe if you had some more people to help you could make these and sell them to the public and I think the portal fanbase would just go crazy banana bonzai on these turrets but just a thought. And could you send us another update video if and when you have the white turret shell that'd be awesome!

Hey! Awesome job buddy! Just wondering, did you include the turret to reset back to its default position after a timer, or did your demo just not last long enough? I always thought their loneliness was their successful attribute. You would leave there reference, and they would be sad, and reset.

Magnificent! Great work getting everything working together, and it even looks pretty good without the shell on too :) Why are the servo's so jerky if you don't mind me asking? Is it because of the time it takes to process the image? Maybe you could lower the resolution/sampling rate? I want to play with this thing so bad!

Ah okay, definitely look into Processing. I imagine you could be tracking targets a lot faster with it. Some other people suggested using a Kinect, which would be a cool idea as well(if a bit short range).

Glad to see Matlab has some applications beyond homework solving. I mean, of course I knew it did, but it's cool to see it in action.

I want to do this kinda stuff, but I don't know enough yet as a Junior in Mechanical Engineering. In fact, I haven't taken a basic circuits course yet because I started out as Civil and decided to switch this semester.

How hard would it be to make it be able to target things that aren't the pink shirt? You could track motion by subtracting each frame from the previous frame (or the other way around) and determine where to fire by subtracting the baseline image from the target of the image and then calculating the center of whatever's left, but I have no idea how hard that would be to actually program or how fast or accurate it would be.

Dude this guy and 2 others like him a few million dollars and endless dominos pizza and they could change the world. But ignore that, here have more justin bieber reality shows for the foodnetwork. youre all sheep!