Skip to content

Consuming WCF Services

April 24, 2012

While I’m flying into low clouds providing for a turbulent landing in Slovenia I find myself once again thinking about WCF and how far we have come from doing things with xterm like protocols and raw sockets(and to help distract myself, I don’t enjoy flying). WCF has been around in .net since 3.0 where it was codenamed Indigo and is a powerful solution to building service orientated applications. Visual Studio works nicely with adding WCF connections to applications, whether it be WPF, Winforms, Silverlight or windows phone apps. The right-click “Add Service Reference” on a project and fill in all the details is great for novices and testing idea’s quickly. However I find the proxy classes it generates a little heavy and updating them through the IDE to be repetitively time-consuming.

At the moment while im working on the next version of the Rosetta Stone Challenge and changing the server endpoints and data contracts for the wp7 Object Recognition Toolkit, I can be updating them every 15 mins. Then having to update the WPF and wp7 solutions  respectively. Their is command line applications however that can be automated through batch files and the whole thing is done in seconds.

“Svcutil.exe” (or “slsvcutil.exe” for silverlight and wp7)can be started easily through a visual studio command prompt or saved in a pre/post build batch file with the necessary parameters.

You can just automate with a batch file and optional parameter to not recreate data contract’s that you may have in a shared library between your server and client projects.

In the end a successful download and update should look like this from the command line.


Working and usable are two different things

April 15, 2012

While the version I tested with-in the museum worked, it was by no mean user-friendly. It would take up to 30 seconds to save a new image, starting up the app could take up to a minute once it had a large number of image points in their. When developing I always work on the premise of just getting it working for the first version, what ever library’s or what ever takes me the least amount of time to code to see if the concept works.

For example on the phone I was saving every point from the picture which could be in the thousands of points but further testing showed I am getting away with using 150 points and that only takes a few seconds to save which is in the background while the user is typing in the name. On saving points to the phones isolated storage I was just using the built-in .net serialization, while it worked it is not fast enough for the amount of data. In the end I decided to give a .net port of google’s Proto buffers which is giving an acceptable level of performance around 1 point per millisecond so it is loading in under a second generally which the user wont even notice.

There are still a lot more optimizations I can do but the sample app is now changing from something that is working to becoming a usable product.

Rosetta Stone Challenge – Success!!

March 31, 2012

Well, I’m in London for less than 48 hours before I fly out again but I stopped into the British Museum. I fired up the app, took a snapshot of the Rosetta stone to add it into the system and then let the app scan and it found it! I did come away with a lot of good experience though, the Rosetta stone itself is behind a glass case which is highly reflective and a constant stream of tourists taking pictures with flash’s on making the glass even more reflective so the number of feature points found is quite small, so that has given me something to think about. I have taken some pictures to prove it but to be honest the pics are pretty poor.

What I later did was test the app with a statue of Amenhopted and then remembered I had a screen capture app installed which gives a much better result as you can see below.

Debugging WCFservices between the phone and local machine

March 30, 2012

As I continue travelling through the south of France I find a lot of time I don’t have an Internet connection so debugging a WCF service running on the laptop to the phone plugged in wont work with the standard setup. There is a solution however, all you have to do is install the Microsoft network loopback adapter card(software). It will probably just get a default 169.x.x.x ip address but that is okay, we just need a IP address somewhere. Update your local web.config with the machine name to use the same name in WCF client host name, I further installed the IIS Express edition to test with but you will have to update your config in C:\Users\user name here\Documents\IISExpress\config\applicationhost.config with the machine name so the service binds to that address on something like this   <binding protocol=”http” bindingInformation=”*:80:eee” />

Dynmically loading XAML content

March 14, 2012

So I have had a few tight deadlines with work over the last month working many 12 hour days, but now I’m free and travelling for the next 4 months. So while I have continued to work on the project I havent really been discussing my progress. I have a few break through and a few dead ends which taught me a lot although I dumped a lot of code.

But now that I feel that the engine is matching reasonably accurately on small data sets in real-time, I wanted to get a more end to end experience before I spend more time scaling out the system. So I have a known match, let’s get something on the screen. This is something that has been in the back of my mind for a while, I wanted it to be dynamic content that did not have to be preloaded on the phone. Ideally something that the phone could say to a web service I have found this object, you got anything we can show on the screen that is informative ?

So in comes XamlReader.Load(), the answer to my needs. It takes a string of XAML code and spits out XAML parsed code which appears to work for my little test demo. I have simple test class that spits out an Ellipse wrapped in a Grid that gets moved across the screen each time it matches per cycle of the engine. Nothing to exciting but an adequate proof of concept. I found the code here and the author clearly knows more about it then me at the moment. One thing that is essential is having the top-level element contains “xmlns=

So I guess I had better get working on writing a web service to store the xaml animations, it also builds a platform to create a more scalable image matching engine……

So little time, so much code to write…..

RSC Update 2

February 5, 2012

Rosetta Stone Challenge Update 2

Okay, so I have some basic recognition working. But the challenge requires me to walk up and have it recognize the rosette stone; this means I’m going to have to store the point information offline. So I have started experimenting, at the moment every time it starts up it loads some sample pictures(slow and painful) which I have associated with an image and adds it to the internal database. So far I have found that after loading, if we resize the image to the camera size it appears to greatly increase the detection rate. I’m also looking at taking pictures with several different cameras as well as my phone and see how they go. What I have also started developing is the ability to save each snapshot that goes through the engine so I can experiment with them offline and build some consistent tests around to further increase the accuracy.

RSC Update 1

January 26, 2012

Rosetta Stone Challenge Update 1

Well I have a half decent(barley) GUI with the simple workflow of being able to take a snap shot of an object and able to give it a title, and little Status panel telling us whats going on and what it has found.

How it works –  In the background the app will continually scan for interest points and select a subset of points to attempt to match them to the recently saved images. I will discuss the interest point extraction subset selection and matching algorithms over the next few weeks as i fine tune them the challenge.

But for now a few pictures to  of the progression…..

Saving USB

Saving USB

Scanning for USB

Scanning for USB

Found USB

Found USB