Tuesday, October 30, 2012

Trivial CMAKE for OpenSceneGraph

It is often fun to get open source projects working with Visual Studio since a lot of build systems leave out a few Microsoft specific vagaries. With CMAKE life in the last few years has become much easier, though sometimes it requires a bit of digging to locate the right incantations to pull in the right dependencies for a trivial project.

CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
PROJECT(AeroViewer)

SET(TARGET_SRC aeroviewer.cpp )

find_package(OpenSceneGraph REQUIRED osgDB osgUtil osgGA osgViewer osgText)

ADD_EXECUTABLE(aeroviewer ${TARGET_SRC})

INCLUDE_DIRECTORIES(${OPENSCENEGRAPH_INCLUDE_DIRS})
TARGET_LINK_LIBRARIES(aeroviewer ${OPENSCENEGRAPH_LIBRARIES})  


The aim of this quick dash is to add a screen overlay with the company logo to the default osgViewer. This requires adding a geometry node to the scene with some static geometry in camera space. Which ends up being equivalent to a HUD in osg parlance. After a bit of tweaking and rotations in texture space I got this, not too bad for a cold-start in OSG land. This bit of sample code is better for HUD's than the tutorial, the required projection and modelview matrices are encapsulated by the CameraNode.

Saturday, October 20, 2012

Why is gold valuable anyway ? - Midas and Supernovas

Growing up as a child in India in a family of goldsmiths it is hard to ignore the role gold plays in perception of wealth and daily conversation. My uncle would often refer to "stuff" or "maal", meaning gold. On my last visit the regular obsession was checking the current gold price from the wholesalers via SMS. According to a recent article - Man's addiction to gold - India holds pretty large stockpiles of the metal in the proverbial family jewels. It changes hand at marriages as gifts and dowry.

Midas as an allegory of a supernova Gold has no intrinsic bio-chemical value which supports life as the cautionary tale of King Midas points our. Its inherent inertness however gives it great value in the burgeoning electronics industry and it is very rare to start with anyway due to the cosmic element forming processes making it harder and harder to produce heavier elements. The vagaries of nucleosynthesis are so universal that they have even made it to being a Hollywood plot device in "Cowboys and Aliens" where aliens set up a gold mine.

The ultimate statement on how we value things comes down to supply and demand - gold is in short supply due to its nuclear weight and on high demand due to its permanence once acquired. We now just need to find suitable biochemistries or bioelectronics to make it part of a living body. Gold abundance is a measure of the midas touch of supernovas.

Wednesday, October 17, 2012

Making Furniture from Banana

I had a solid grounding in natural fibers and polymer chemistry thanks to my father. My mum still has a picture of him happily holding a sisal leaf. We took this picture in the plantations just outside Mombasa. Well the agave family is pretty notorious, apart from sisal it also gives us pineapples and tequila.
So I tend to talk about the wonders of polymer chemistry often. I kept rambling at the Augustiner Biergarten in Munich about natural fibers, hair and aramids, to slightly disbelieving stares. Ended up learning a bit about making violins out of Kevlar.

The whole chain of thought started on the plane from Adelaide to Kualalumpur. I sat next to Ed organising the overseas operations in Egypt for Papyrus inc and making veneer out of banana stems. He treated me to a nice time in KL on condition that I show the same consideration to any travelling PhD student I meet in the future, when I am a director or something. Otherwise it was a great conference featuring a visit to the EADS solar panel and rocket engine manufacturing facility - which used to serve as the tank manufacturing facility at its inception. As well as plenty of nice technical sessions and a strange conversation regarding compressed sensing and the difference between SAR and optical.

I finally did the IGARSS Conference review survey today, so getting the blog out is timely. May be I will present about point clouds at the next conference and take a break from the SAR stuff. Check this video for what I have been doing recently.


Saturday, August 18, 2012

The sunset cermony at Arche de Triomphe

There are many battles listed on the Arche de Triomphe, they were all fought, but not all of them ended in victory. We walked through Paris starting at Place de La Madeleine filled with red blooms and people sitting on the steps. Thinking this is Paris where building a church is considered a public service, useful in keeping people sane and full of hope. We walked a beeline to the obelisk and lined ourselves up with the Arche de Triomphe along Avenue des Champs-Élysées.

We slowly waded into the ocean of tourists, passed a man cutting out silouhettes in 2 minutes using just scissors, got pigeon poop on my bag, saw the citroen demo car with solar panels on the roof and had a burger at Q being served by a very tall girl. We got lost crossing the roundabout to get to the arch and went round in a cricle before we figured out the right underground tunnel to take. As usual there was a huge queue to climb the Arche, I am not really into queues so we went and sat under the arch. All these random events led us to sit next to a very small old lady (we later found out that she was 92), carrying a large flag.

I started doing my usual sketching thing, the old lady was a subject you just can't pass by. Some tourists noticed us and introduced us to the old lady. She spoke excellent English and had served with the Free French Forces under Charles de Gaulle during WWII, in intelligence. We came around to discussing the olympics and to our surprise she started reciting the venues of all the olympics since the 40's. I did some quick sketches of her and dutifully handed them over, she asked us to stay for the sunset ceremony alongside all the dignitaries in suits.

It was a rather odd half an hour as we struggled to be inconspicuous among all the military attire and the ambassadors. The tourists were all herded out and looked on from the outside. All the national anthems of allied countries were played - France, UK, Australia and some I did not recognize. Wreaths were laid on the memorial to the fallen soldiers. The logo on my t-shirt was mistaken for a regimental emblem and I was asked which one I belonged to. It was a rather strange end to our random walk through Paris. Thanks for letting us stay Paulette.

Tuesday, July 17, 2012

Redrawing Diagrams - Fun with Inkscape

Hand drawn curves
Good diagrams in publications are hard to come by and sometimes already published ones get re-used exactly due to the lack of the know-how on reproducing them. One classic example is the Entropy-Alpha space diagram produced by Cloud-Pottier. Though the diagram is simple enough and the space limit curves can be computed from the equations, it is sufficiently complex given no full recipe to warrant copying as-is. Copying with attribution is standard practice in science, but gives no insight into how the diagram was originally produced without contact with the authors or forensic analysis of the lines. The tell-tale randomness of the curves in this particular one makes me of the opinion that it was hand drawn, I will have to as Shane Cloude when I meet him over a beer in Munich.
Entropy/Alpha diagram



So I decided to try out my Inkscape skills and redraw the diagram from scratch using some theory and some free-hand approximations. Without definitive parametric equations for the bounding curves it is rather like trying to work out how the pyramids at Giza were built.

Friday, July 13, 2012

Lots of images to lots of OBJ to lots of images

Working with Structure from Motion and Dense matching can be a lot of fun. If the project get sufficiently big though, the reconstructed models is broken up into multiple Wavefrom Object files and can be difficult visualise and render. I like doing most of my rendering in Blender, and the handy Python API for loading OBJ files makes the job of getting all the files in easy.

To grab a bunch of obj files from a folder into Blender simply script this in the console:

import glob
objects = glob.glob("Filepath\*.obj")
for obj in objects:
    try:
        bpy.ops.import_scene.obj(filepath=obj, axis_forward='X', axis_up='Z')
    except:
        print("Failed "+obj)

Just like that you create a scene with 100's of object tiles. Make sure they are viewed in outline mode, so that the display is zippy while setting up lights, cameras and animation action. Start off the render and go get a beverage.


Friday, July 6, 2012

Rage against the machine - Pattern Matching

One of the major strengths (and sometimes weakness) of the human brain is its ability to perform pattern matching - the classic is where people play more attention while playing games and digitising and gamifying the airport security leads to less false positives. We perform heuristics in everything we see and hear, often coming to conclusions based on partial information, based on extrapolation performed using past experience. This is why upper-case letters in English are so much easier to read since we have built up heuristics to infer the letter from the top-half, people who write in all capitals seem to be almost shouting as our visual heuristics take the cue.

Ambiguous painting
Machines are getting better at the heuristics as well as brute force, we have passed them on just the way we pass on preconceptions of right and wrong, beauty and religion to our children. Based on this system of thought and accumulated body of knowledge, machines can perform pattern matching tasks they are programmed for in vastly superior ways than humans. All they demand in return is energy, materials to build them and intelligent human beings to make some long intellectual marches in programming them.
Cat videos are the dominant species
In someways the rote jobs of pure pattern matching has made us mental Neanderthals with short neural loops focused on ambush hunting only the job at hand, rather than thinking long term strategy. The long chase where all the short easy pattern matching jobs have been mechanised is for the more creative, the artists. Yet there is still need for the engineer to keep the machines functioning. There are always predictions of race of against the machines. We still need to communicate our mental models imperfectly via whatever means.
Genies are just machines with Genius

May be with exposure to lots of cat videos and artwork, the machine will eventually learn to play with cats while painting, and we will keep building bigger machines since we can't be born biologically with bigger skulls or weild GeV's with our finger tips.