# Tag Archive for 'Code'

September 14, 2011

### The Future of QR Codes

Quick Response (QR) codes are popping up around retail spaces more and more these days. I once saw them as a gimmick, but after watching a video about how Tesco, a South Korean grocery store chain, grew their customer base by 76% by using QR codes, I am now a believer. Tesco replicated grocery shelves with QR codes placed under every item, and posted them on billboards in subways – essentially bringing the grocery store directly to the consumer. Since South Koreans work long hours, Tesco needed a way to reach customers that are not able to make it to the physical store between commutes. With the Tesco subway billboards, customers are able to scan the QR code and immediately have their groceries delivered to their homes. Within a few years, QR codes will be an integral part of retail spaces and essential for experiential marketing campaigns.

Would you use this service if it was available?

Leave us a comment!

August 3, 2011

### Simple Tips: Application Image Processing

A lot of people are familiar with the WriteableBitmapEx project on Codeplex. I got an opportunity to use it in a recent project of mine, and although many of its functions are very helpful, I noticed a couple common image processing functions it was missing. It supports resizable blits (with bilinear filtering), flips, and rotates, which are nice. More impressively, it supports arbitrary convolutions, which are very powerful and versatile in the image processing world. What it was missing, however, was the ability to perform a linear colorspace transform, and apply a color ramp lookup table.

Linear transforms in an image’s color space (RGB in the case of this implementation) can perform a variety of functions. They work by treating each pixel as a vector of color components, <R, G, B, A>. That vector is transformed by a 4×4 matrix, and the output vector represents the new color. To use this function, call

WriteableBitmapColorExtensions.TransformColors(Matrix3D matrix);

The matrix you supply determines how the color is transformed.  The alpha component in most images is usually 1, making the matrix usually affine, though the method does not give it special treatment, so you may get some… interesting… behavior with translucent images, depending on how you put your matrix together.

The WriteableBitmapColorExtensions class defines a few common ones:

NegativeTransform – Produces an image’s film negative

$latex \left( \begin{matrix}1&0&0&-1 \\ 0&1&0&-1 \\ 0&0&1&-1 \\ 0&0&0&1 \end{matrix} \right)$

BlackAndWhiteTransform – Transforms the image into black and white

$latex \left( \begin{matrix}0.30&0.30&0.30&0 \\ 0.59&0.59&0.59&0 \\ 0.11&0.11&0.11&0 \\ 0&0&0&1 \end{matrix} \right)$

SepiaTransform – Transform an image into sepia

$latex \left( \begin{matrix}0.393&0.349&0.272&0 \\ 0.769&0.686&0.534&0 \\ 0.189&0.168&0.131&0 \\ 0&0&0&1 \end{matrix} \right)$

What else can you do with it? You can try brightness changes:

$latex Brightness(B) = \left( \begin{matrix}B&0&0&0 \\ 0&B&0&0 \\ 0&0&B&0 \\ 0&0&0&1 \end{matrix} \right)$

Note you can vary the brightness of independent color components, if you like.

You can also desaturate an image by interpolating between the identity matrix and the black and white matrix. If your saturation level goes from 0 (black and white) to 1 (normal):

$latex Saturation(S)= Brightness(S) + BlackAndWhiteTransform * (1 – S)$

You can even do a hue shift. A hue shift basically rotates a color vector around the <1, 1, 1> axis:

HueShift(Degrees) = Matrix3D.Identity.Rotate(Degrees, new Vector3D(1,1,1))

The purists among us will note that this isn’t exactly right… to do a true hue shift you need to normalize the brightness of the color components first (you can use the Brightness(S) function above), but this gets the idea across. The sample image here uses a subtle rotation of 15 degrees.

Those are the ‘ordinary’ functions that a color transform can do, but you can stylize things as well.  For example, you can swap around or even turn off color components:

There are other interesting things you can do with TransformColors as well, such as skewing colors or projecting them onto a plane (or a line, creating a nice two-tone effect—this is essentially what the black and white matrix does). And remember the most powerful feature of linear transformations: you can take any or all of these effects, combine them into a single matrix, and apply all of them to an image at once without any additional performance hit.

The other function introduced into the library, which I will elaborate more on in my next post, is WriteableBitmapColorExtensions. RampColors. This method replaces all the colors in an image using a lookup table. This is useful for nonlinear things like gamma correction.  In fact, gamma correction is by far the most common application of this function, so I included a special method just for it, WriteableBitmapColorExtensions.AdjustGamma.

May 25, 2011

### @lbugnion Brings you Mango from the Trenches via galasoft

We’ve already posted some details about our Mango updates to the IMDb application, which were unveiled at MIX11.  Our own beloved Integrator, @lbugnion, dives into the steps that were taken to add a new Live Tile on Windows Phone 7 on his personal blog. You owe it to yourself to check out his insights if you are a software developer working with Windows Phone 7.

Here’s a taste:

Very important: The pictures used for the live tile must be 173×173 pixels PNG or JPG, and added to the project with the Build Action set to Content. To change this, select the images in the Solution Explorer, press F4 to display the Properties and then change the Build Action to Content, and the “Copy to Output Directory” property to “Copy if Newer”.

Visit Laurent’s blog to get the full story! If you’ve had a chance to work with the new Mango features and would like to share your story on the IdentityMine blog, let us know in the comments.

April 13, 2011

### Deep Dive MVVM at #MIX11

IdentityMine Integrator and Microsoft MVP, Laurent Bugnion (@lbugnion) presented Deep Dive MVVM at MIX11 yesterday to a packed house.  The session was a follow up to Laurent’s MVVM presentation at MIX10 and was intended to answer some of the more common questions that Laurent received over the past year.

Laurent’s posted code samples from his presentation on his blog here.  Check it out and make a social application of your very own!

You can also see Laurent in an interview with Channel 9 today at 1:45pt.

Laurent Bugnion dives into MVVM

#ms_mix_e

April 13, 2011

### Greetings from Tuesday Night at #MIX11

#ms_mix_v

Greetings from day one at MIX11! Of course, it’s technically day two, but in Vegas, Midnight is still yesterday.

Today’s running theme was solidly around the idea of native experiences, regardless of the development platform.  There is a lot of discussion around the impact that multiple browsers will have on the native experience.

There is a notable lack of discussion about the interplay of HTML5 and Silverlight so far, so this topic is a lively source of debate in the hallways and over coffee among the attendees.  Tomorrow is going to include more Silverlight and mobile discussion – stay tuned for more on that front.  The truth is that the two technologies will very likely exist in harmony, but speculating about their compatibility is not nearly as fun as speculating about a mud pit death match.

I attended both an Azure session and @lbugnion’s Deep Dive MVVM session.

“What’s New in the Windows Azure Platform” was presented by James Conrad, and the session focused on Azure’s open and flexible structure. Azure is going to be free through January 1, 2012; and after that it will be offered at a low rate.  The low cost is the lure to using this new(ish) technology.  The demonstrations used in the sessoin will be available online soon (we’ll post an update when the time comes.)

Deep Dive MVVM was presented by @lbugnion to a completely packed house.  It was a code intensive session that was intended for advanced users of MVVM.  Laurent created a social application using data taken from friends in the dev community.  Laurent also tipped his hat that he is celebrating his 40th birthday tomorrow – I’m sure he’ll let you buy him a drink J

Laurent sent some love to IdentityMine by wearing his IdentityMine IM: Creative shirt.  He also showcased new MVVM 4 features such as ObservableObject and demonstrated use of Expression Blend to produce an application for Windows Phone 7.

A running theme in the conference was the importance of personal control of a digital experience – whether it’s facilitated by Silverlight or HTML5 (or any other platform, for that matter).  We are tasked with creating digital environments that allow for mass customization so that users can connect with a commonly understood brand or paradigm in a personalized way.

Stay tuned for more from MIX11 tomorrow.  You can follow IdentityMine on Twitter as we live tweet the keynotes and sessions, and the #MIX11 hashtag is definitely worth following.