Can anyone point me to a shape recognition algorithm, preferably in C#/Java but other languages are fine too.
i would suggest you take a look at the AForge open source library for such things: http://code.google.com/p/aforge/ it is really awsome!
indeed. i've played with it a lot... also here's a watershed transform i created that will be included in the library in the future if you need it :) http://weblogs.sqlteam.com/mladenp/archive/2008/02/11/Watershed-Image-Segmentation-in-C.aspx
acctually you can use it. i've had a talk about this very issue with the author of Aforge and he said that it's OK to use it for a commercial project. so i guess you should mail and ask him yourself.
For commercial applications, especially industrial ones, the Matrox Imaging Library provides pricey but very robust algorithms for shape finding. If free or low priced options do not work out for you, and your customer is willing to pay the bill, this might be a good option.