Archive for the ‘Software’ Category

Drawing geodesic curves using the Bing maps Silverlight control

Wednesday, June 30th, 2010

For an upcoming post I wanted to be able to plot the shortest routes between various positions on the Earth using the Bing Maps Silverlight control. Although since I started working on the problem Bing have provided a similar feature with their Distance Calculator App, the functions are not available for reuse via the public API. Interested developers may just want to skip the maths and just download the code.

Geodesic source code for Silverlight 4.0

Geodesics

Geodesic

The shortest path between two points on an arbitrary surface is called a Geodesic, and on a sphere, it is a Great Circle. Modelling the surface of the earth as a perfect sphere, the shortest distance between any two locations on the surface is then described by a section of a Great Circle, ie an arc that lies on the plane that is described by the vectors between its start and end points and the Earth’s centre ( see figure 1 ).

With this information, one way ( and the way I have adopted ) to plot such a curve is as follows:

  1. Generate the points of the curve in two dimensions using the parametric equation of a circle.
  2. Transform the plane of the 2d curve into 3D space such that it intersects the end points on the sphere, and the sphere’s centre.
  3. Project the transformed points back into 2D space using the Mercator projection equations.

(more…)

Visualizing the Prime Ministerial Debates

Thursday, April 29th, 2010
Nouns used by Gordon Brown

For the first time, the main Prime Ministerial candidates for the 2010 UK General Elections, will take part in three live debates. Since the BBC have kindly made the full transcripts available, I decided to have a go at analyzing the data and creating a visual representation in the form of word clouds. I am currently working on my own visualization software, but in the meantime these have been done using Wordle.

(more…)

Near Infra Red Pseudocolour using LAB Colour Separations

Wednesday, March 24th, 2010
At the back of Clare College

As 2010 is the 100th anniversary of the first published infra red photograph, I thought I’d try my hand using my own digital camera and some easily acquired accessories. If you want, you can skip the theory and go straight to the description of the method and a script for Photoshop.

A quick overview of IR photography

The CCD that is responsible for recording the images photographed by most digital cameras, is already sensitive to the near infra red part of the spectrum. That is, the part of the spectrum outside of the range visible to the human eye, but not so far as that used for, for example, thermal imaging. Since most photographers are not interested in light that they can’t see, this light is usually filtered out by an infra red cutoff filter placed inside the camera body, directly in front of the CCD. However, such filters are imperfect, so with some camera models by CCD spectrum response combining a long exposure with an infra red transmitting filter placed in front of the lens, some of that IR light can be recovered. The figure shows the basic principle, though I should add that the graphs are just a sketch to illustrate the principle and don’t represent an actual CCD response curve.

(more…)

Silverlight and CUDA interop

Friday, January 15th, 2010

mandrill
Update – source code now available

Microsoft have recently released a beta of Silverlight 4, which has limited support for native interoperation using COM. Potentially, this example could be applied to any number of native interop scenarios, however for this example I have chosen to use Nvidia’s CUDA technology.

Disclaimer : This is an example of what can be done, not necessarily, and in all likelihood, an example of how it should be done.

About CUDA

Up until around 2001 PC graphics cards, though powerful, implemented a fixed function pipeline that limited use to whatever was exposed by the APIs, usually Direct3D or OpenGL. The addition of a programmable pixel pipeline led to the use of graphics cards for more general computation tasks; at first using shaders directly, followed by higher level GPU specific programming languages, such as Brook, SH, and later NVidia’s CUDA. Most of this work was, and is, documented by the GPGPU group. NVIDIA’s website shows CUDA being used in a wide variety of applications but in practice it is best employed in so called “embarassingly parallel” problems.
(more…)