Saturday, March 01, 2008

I have started liking groups so much, that I think its worth spending some time drawing out these beautiful things with some care. These mathematical abstractions have some really nice corresponding pictures.

 

image

This is the dihedral group D3, produced by
s^3 = i
(st)^2 = i

 

image   image

The quaternion group.

Quaternions are a generalization of complex numbers. I am a little fascinated with the above group because a long time back before I had known of Group theory I had constructed the above diagram in my attempt to understand quaternions and multi-dimensional geometry.

The discovery of quaternions is credited to the great mathematician Hamilton. Story has it that Hamilton had been pondering the issue for a quite a while and fundamental equation of quaternions came to him when he was taking a walk with his wife. It is said he carved the equation into bridge where he was at that time. The bridge, now has a plaque to this effect. So here is the fundamental equation:

ijk = -1

From this we can also derive i^2 = j^2 = k^2 = -1

 

image

The group produced by
s^3 = i
(-s)ts = t^2

where "-s" is to be read as "s inverse".

Here is a slightly different rendition of the same group:

image

 

Here is a different group:

image

This is the group generated by:
s^4 = i
(-s)ts = t^2
t^15 = i

 

image

This is the group generated by a variation of the above equations:
s^4 = i
(-s)ts = t^2
t^5 = i

Saturday, March 01, 2008 3:21:05 PM (Eastern Standard Time, UTC-05:00)  #    Comments [3]  | 

Many years back I worked full time at Microsoft on one of the many projects related to Vista (or what was then called Longhorn). Last December I was visiting friends in the Redmond area when one of the jokingly observed how the code I had written for Microsoft still hadn't seen light of day, while two and a half years later, I had moved on and completed my Masters and had started on my PhD.

This wasn't a sort of accidental slip, but I remember we were told at that time that if we had any ideas to suggest for Vista, they better be ideas that will be new and interesting 3-4 years later when the OS actually ships. This is a tall order for any sort of idea, much less for the volatile world of "software project" ideas.

While this seemed like very ironic humor at that time, over the past month or so, once in a while I thought about what that meant. After all, I had spent a year writing all that code. A very busy year at that - I had spent 15+ hours a day, I daresay, that was my average day, struggling with the turmoil of the massive engineering effort that was Vista.

I wasn't a *great* programmer by many standards, but I'd like to think that I was better than many I had encountered. 15+ hours of my time for about a year, took a lot of out of my life and it didn't seem to have amounted to anything! Sure I was being paid a handsomely, but one one like to think that one's efforts contribute to the world in some way as well. After all that year was full of deadlines and things being rushed to be completed and such. What came of all of it? If it came to nothing, what a waste of life that was...

A few weeks back, I got a call from Steve who works with Google (who has a fascinating blog btw), about coming back and working with them on some stuff. I casually asked what happened about the last thing I had worked on, when I was there last summer. I had made some extensions to the Rhino compiler, the largest part of which was adding the yield control operator to it. Steve said that they were using it. Somewhere in the back of my mind I said "What?!".

Maybe my programming has matured over the years. Maybe the ~6 hrs a day I spent in office as an intern produced production quality code. I somehow assumed that it wouldn't see any real world use. Was it really that special that it was ready for real world use? Don't get me wrong, it wasn't bad code. But it was code that only written, not "baked" for years.

Maybe there was another reason. Maybe, it wasn't a property of the code at all, but of the fact that there was something radically different about the outlooks of both these companies. There are many thing one can say about this "difference in outlook", positive and negative things things about both. But a shift that causes developers to feel effective by default as opposed to feeling ineffective by default, is an empowering thought. "If I build it for you, what will become of it?"

Maybe mine was an isolated case of wasted engineering effort and this is nitpicking. If that's so, I'll be happy for it.

Saturday, March 01, 2008 12:07:22 AM (Eastern Standard Time, UTC-05:00)  #    Comments [2]  | 
 Sunday, February 24, 2008

Part 1 - DOF and Aperture

If you haven't read my photography disclaimer, take a look.

 

Before we start, here are links to one or two external DOF articles:

http://www.mir.com.my/rb/photography/fototech/htmls/depth.html

This link shows some of the math behind the graphs that I plot here. I find it useful to see the graphs plotted in this article to visualize these relationships. You may find the tables they have handy.
http://www.conent.com/ConAdv/Encyclopaedia/Photography/CNQ_CAPhotography001.asp 

 

Continuing from where we left of (Part 1 - DOF and Aperture), lets take a look at the relationship between DOF and distance to the object being focused on a little more closely. In the previous graphs we could get some insight into this relationship. Here we will plot distance on the x-axis and DOF on the y-axis.

 image image

The two graphs above show the DOF changes for the fixed aperture value f/4 and focal length of 50mm. The first graph shows the variation of DOF over a relatively short distances of <5m. The second graph shows how this varies over greater distances and show the non-linearities in the DOF when greater focusing distances are involved. From a distances of about 20m DOF start shooting up and by ~30m you get infinite DOF.

Lets throw in some more aperture values and see what we get. f/1/4, f/1.8, f/2.8, f/4.0, f/5.6

image  image

Nothing very interesting happening with the shorter distances. The larger distances show the larger fstop numbers curving off sooner. This is consistent with the idea that the greater the aperture (i.e. lesser the f-stop value) the lesser the DOF. If you have a lens that can provide f/1.4 you get a rather nice DOF control even upto distances of about 50m! The Canon 50mm f/1.4 prime that costs about 300$ should do that. The much cheaper Canon 50mm f/1.8 prime would be expected to follow the green curve - rather sweet for a 80$ lens.

Lets look at some larger f-stop values.

image image

At f/22 even in distances under 5m we see the DOF curving up. From roughly 5m to 20m for the aperture range of f/5.6 to f/22 we start to get infinite DOF.

 

Now lets vary the focal length a bit, starting with some wide shots.

image

These are plotted for a f/4 aperture. Within 5m each of these DOF graphs curve upward to infinity. At 10mm, if you are focusing on something that a little over a meter away you get infinite DOF! If you are wondering how 10mm is relevant, the Rebel line of cameras support the EFS mount and currently the widest (non-fisheye) lens you can get if the Canon 10-22mm lens - its a beauty.

Lets look at some medium range lengths.

image image

25mm curves upward at roughly 6m. The longer the focal length, the narrower the DOF. A 50mm would curve upward at about 30 meters.

image image

At small distances all these focal length's are very well behaved. You get very narrow DOF and with a good lens, you should get a great bokeh! Each of these focal lengths only reluctantly yield to large DOFs. So if you need to zoom into something thats 50m away and need an infinite DOF, you need to stop down the aperture. :)

There you go. The graphs should show roughly the real world values that you should expect to see with your equipment. You might want to take some approximate readings off these graphs and then go out in the field and see how these values work for you.

In the next part (whenever I get down to writing it), we'll plot the remaining combination  - DOF against focal length.

Sunday, February 24, 2008 11:10:32 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 
 Friday, February 22, 2008

Last week I watched Stanley Kubrick's 1975 classic, Barry Lyndon. What a movie! I haven't seen a movie with as gorgeous realistic photography in a while. Kubrick's composition is perfect, every single shot. The lighting and the story telling is awesome.

Barry Lyndon is the story of the life of a curios Irish character, Redmond Barry, who goes onto become the wealthy 'Barry Lyndon'. It is a 3+ hours epic, that is enjoyable right through. Its a nice tale and the way it is told is excellent. A must watch, with some wine and cheese.

        

As someone with an interest in photography, I am stumped by how Kubrick achieved some of the shots in this movie. The rich colors, the way the light looks... In some ways the film was a bit of a photographer's dream project. Most scenes were shot in natural light - legend has it that the film didn't use much artificial lighting at all. In fact the beautiful candle lit scenes in the movie were shot in actual candle light alone.

Quoting from http://www.visual-memory.co.uk/sk/ac/len/page1.htm:

At the very early stages of his preparation for "BARRY LYNDON", Kubrick scoured the world looking for exotic, ultra-fast lenses, because he knew he would be shooting extremely low light level scenes. It was his objective, incredible as it seemed at the time, to photograph candle-lit scenes in old English castles by only the light of the candles themselves! A former still photographer for Look magazine, Kubrick has become extremely knowledgeable with regard to lenses and, in fact, has taught himself every phase of the technical application of his filming equipment. He called one day to ask me if I thought I could fit a Zeiss lens he had procured, which had a focal length of 50mm and a maximum aperture of f/O.7. He sent me the dimensional specifications, and I reported that it was impossible to fit the lens to his BNC because of its large diameter and also because the rear element came within 4mm of the film plane. Stanley, being the meticulous craftsman that he is, would not take 'No" for an answer and persisted until I reluctantly agreed to take a hard look at the problem.

The lens that is spoken of here is one that the famous lens manufacturer Carl Zeiss made for NASA. Not many of us can get our hands on 0.7 aperture lens today, even for still photography. As a matter of fact I don't know of any that are commercially available. Canon's 50mm prime at f/1.8 is 80$ (USD), the f/1.4 version of the lens is about 300$ and there is a L class f/1.2 lens which is about 1,300$. It stops there it doesn't go any lower. Canon once had a f/1.0 lens, which I believe is now discontinued.

Now that I look around, its 2nd on the "Ten Movies Every Photographer Should See" list. The first is, of course, Baraka.

Friday, February 22, 2008 1:40:04 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 
 Tuesday, February 19, 2008

Part 2- DOF and Distance

If you haven't read my photography disclaimer, I recommend you read it now.

Photography with SLRs essentially involves navigating the multi-dimensional space created by many variables - aperture, shutter speed, ISO, exposure (ev), DOF, noise, focal length, focusing distance etc. In part, your effectiveness as a photographer depends on how well you understand this space and how well you can navigate it.

In this writeup I look at DOF. Before you read this article, I expect you already know what DOF is, and that you have some experience trying to control it. Browse around and a bit and read about DOF before you look at this article. Know what the terms mean and such. Here are two little articles that you introduce some terminology for you.

http://www.dofmaster.com/dofjs.html
http://www.dpreview.com/learn/?/key=depth_of_field

Here are some slightly more explanatory articles:

http://www.luminous-landscape.com/tutorials/understanding-series/dof.shtml 
http://www.cambridgeincolour.com/tutorials/depth-of-field.htm

Most books, like Bryan Peterson's popular "Understanding Exposure", give you a some perspective into DOF, how aperture affects DOF and how to use it creatively. I have always been a bit confused by depth of field because it never seemed to work quiet the way I expected. I always seemed to me that DOF relationships are not linear in the space of the variables that affect it. What I mean by that is that when I change a variable that affects DOF, say the aperture, it does not seem to change DOF at the same rate.

So what variables affect DOF? As best as I know they are not just aperture, but include aperture, focal length, focusing distance and camera type. Look at the URLs above, they have  DOF calculators there that accept values for these variables and give you various DOF values back. What we are going to do here is to plot some graphs between these to better visualize how one variable affects another. My graphs are based of the equations that run the DOF calculator on dpreview and are hence only as accurate as those equations are. What value you get out of this depends on how closely you look at the graphs and try to visualize what the curves mean in terms of actual photography.

 

This time we are going to look at the most frequently expressed relationship, that of DOF and Aperture.

The graph below shows DOF plotted against aperture for a focal length of 50mm and focusing distance of 1m (ie the object that you are focusing on is 1m away). This plot is for the Digital Rebel XT (the EOS 350d) and should hold for any 1.6x senor DSLR such as the Rebel, Rebel XTi and such.

image

The aperture has been varied from f/1 to f/32. Assuming we (ever) have an affordable lens at f/1. There are two lines in the picture. The lower one corresponds to the nearest point that will be in focus and the upper one corresponds to the farthest point that will be in focus. So at f/4, the region of focus starts at roughly 2.5cm in front of the point of focus and extends to about 2.5cm behind it. The total DOF at f/4 is about 5cm.

Since you are at the same position with respect to the object you are photographing and that focal length is 50mm throughout, changing the aperture will affect the depth of field and exposure time (the shutter speed) needed to maintain the same exposure value.

Notice how the graph tends to curve a bit? Lets see how the DOF curve looks when plotted at different distances. Here are the curves for some smaller distances all in the same graph.

image

For each focusing distance there are two lines, the lower one being the nearest point in focus and the farther one being the farthest point in focus. Some interesting things to note: 1) The DOF does not increase very much if you are focusing on close objects. 2) For short distances, of under a meter, the DOF seems to grow linearly.

Lets look at some greater distances.

image

Here the non linearities become very apparent. This graphs plots DOF curves at distances of 1 to 5 meters. Look at the y-axis, note that each unit corresponds to 2 meters. The pair of green lines representing the two meter focusing distance seems to increase almost linearly. At 3 meters, aperture values of 22 and above have rather large farthest points of focus.

The general trend is this: at greater focusing distances the father point of focus increases exponentially on increasing the aperture. In fact its worse than just exponential, the values hit infinity relatively quickly. So at focusing distance of 5m at f/22, the farthest point of focus has hit infinity.

Lets look at some greater distances.

image

At larger distances, smaller apertures lead to infinite DOF values. At 50m, f/4 already gives you infinite DOF! Even at 10m, there is a region of focus that is about 4-5m at f/4. Another way to look at this is that DOF tricks make sense only if the object in question is relatively close to you - i.e. within 2 or 3 meters. Well, that's not entirely true - we haven't heard what focal length has to say about it. But it does seem true at 50mm.

Here are some greater distances that show degenerate version of the above curves.

image 

Now lets go back to the first graph where we were at 1m and 50mm focal length. Lets look at some graphs that show the effect of changing the focal length. Along the x-axis we still vary the aperture value and on the y-axis we plot the DOF. We are just going to draw multiple graphs based on changing the focal length (while keeping the distance fixed).

image

So at wider apertures, the DOF increases. The effect of going from 50mm to 60mm, visually will also be that the object occupies a larger part of your frame. This is roughly what you get were you to stay at 50mm and step closer to the object. From this can we conclude that if the object stays roughly the same size in your screen, the DOF stays the same? I don't know yet. But the graphs seem to indicate so.

Let look at some wider focal lengths. The widest non-fisheye lens one can get for the Rebel series is the 10-22mm lens. (Its an awesome lens btw.) So lets start plotting at 10.

image

At 10mm f/5.6, we have already hit infinite DOF even when the object is just 1m away. At 18mm we hit infinity at about f/15. At 18mm and f/4 we have a decently small area of DOF, however remember how easily this degenerates based on your distance graphs? So if you want to take advantage of DOF when you are at the wide end, you must be pretty close to the object and have a wide open aperture (the smaller the numeric value of aperture, the larger is the actual aperture i.e. more light is allowed onto the sensor).

Lets look at some longer ranges.

image

Notice that the units of the y-axis have changed. At longer ranges (70mm to 120mm) the DOF stays small and concise, good enough to bring out that beautiful bokeh. Greater zooms have narrower DOFs - I don't bother to plot those graphs here. Its easy enough to imagine how they'd look.

 

So what do we have to take away. DOF does increase with aperture, but usually only for short distances. For greater distances there is non-linear increase in DOF often hitting infinity. Similarly at wider focal lengths you get a larger DOF for the same aperture. On increasing the focal length DOF does get narrower until some point where the DOF-aperture relationship starts to look linear again.

Distance from the object and the zoom (focal length) both DOF inversely. Increasing distance increases DOF and increasing zoom decreases it. In other words, if you were to step back but zoom in tighter to compensate, the increased distances and the increased zoom might compensate for each other giving you roughly the same DOF. (I would be able to assert this with some certainty if I have equations for the size of the image on the sensor.)

That said, if you want to take a picture whose beauty depends on DOF and you are willing to vary the object size in the final image (maybe you can compensate by cropping?), understanding the relationship between distance/zoom and DOF will come in handy. In the later parts of this write-up I hope to go into that. Let me know what you think.

Part 2 - DOF and Distance

Tuesday, February 19, 2008 9:44:57 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 

I am not a professional photographer. I am pursuing my PhD in theoretical Computer Science and I enjoy photography. Nearly all I what I have to say about photography comes with my experience with my EOS 350d that I have had for about 2 years, at the time of this writing. Hence take my opinions and suggestions with some discretion.

The art of "painting with light" has many ingredients. There are matters of spirit that each person brings - your aesthetics, your sense of beauty, your evaluation of what is worth shooting, etc. And then there are aspects of photography that involve understanding the nature of the machine and laws that govern it. To the latter part, I realized only recently, that I can apply my relatively abundant geekiness, potentially compensating part of my shortcomings in aesthetics. Hence my blog entries about photography.

Of course, some have more skill.

Tuesday, February 19, 2008 8:59:19 AM (Eastern Standard Time, UTC-05:00)  #    Comments [1]  | 
 Tuesday, February 12, 2008

Symmetry groups are beautiful and fascinating.

image

Cayley diagram for the Symmetry Group of a Cube, 

We can write some simple equations based on "following arrows" in the diagram. If red is "a" and blue is "b", we can say many things. "i" is the identity. If we take a sequence of arrows starting from a point and if the sequence of arrows lands us back at the starting point, then the path forms a closed loop and is equivalent to not having left the point at all.

a^4 = i
(ab)^3 = i
(abb)^2 = i
(aabb)^2 = i

Note that "a" and "b" are equivalent. They can be interchanged in the equations. Hence we may also conclude

b^4 = i
(ba)^3 = i
(baa)^2 = i
(bbaa)^2 = i

Similarly any "a" can be replaced by "-a", the reverse path, or any "b" by "-b". Also not that "aaa" is the same as "-a". Hence we can write:

aaa = -a

And hence,
(aaab)^3 = ((-a)b)^3 = i
(aaabb)^2 = ((-a)bb)^2 = i

Any sequence that forms a loop (equals i) can be started at any point (ie can be rotated) and it still forms a loop. Hence the following are equivalent.

(aba)^4 = i = aba.aba.aba.aba = aab.aab.aab.aab = (aab)^4.

hence we have,
(aab)^4 = i
(baa)^4 = i
(abba)^2 = i

Of course, I have missed some. You can fill them in with what you know now.

 

Now if we select "c" to be some string a and b, such that c^3 = 1, for example c = ab, we can draw a new cayley diagram from the resulting triangles and one of the squares (example a^4 = 1). The "c" arrows are drawn in green here.

image

This maybe visualized as a solid. A cube with each vertex replaced by a triangle and each edge having the width of the triangle's side. Now a very good diagram of the front view:

image 

 

The above group, corresponding to the diagrams, has a name - it is the symmetry group S4. It corresponds to the permutations of 4 character tuple, (A,B,C,D). How many permutations are there? There are 24. These can be though of as the 24 different points on the above diagram.

 

prev: Symmetry Group of a Tetrahedron

Tuesday, February 12, 2008 1:12:27 AM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  | 
 Monday, February 11, 2008

I got my new baby this Friday. The Canon 24-105 L:

Friday was a busy day - meeting with Dybvig, Sabry and Michael Adams, followed by attending some of the Preparing Future Faculty conference talks, followed by a talk about "Exploiting Online Games" by Gary McGraw, followed by a talk about "A Theory of Hygienic Macros" by Dave Herman. I rush home after all of this to see the Amazon package at my door. Quickly unpack, eyes gleam, say "my preciousss..." for sometime and then quickly rush out for dinner with some of the PL folk.

Initial impressions - the lens is build like a tank. Its also fairly solidly built. Its thick and relatively short, with a filter diameter of 77mm it dwarfs the camera. In fact, one of the most solidly build lenses I have seen. Had it been not such a crime to the lens, it might even be used as weapon of self defense. "He was bludgeoned to death with a 24-105'. "Quid pro quo Clarice, you indeed do have a maniac on your hands".

This is also the first lens with which I feel I can manually focus with some reliability. The little viewfinder on the 350d is indeed limiting, but a good lens seems to make a lot of difference.

 

All that said, I have been able to play with it much. Bloomington has been real windy this weekend at -8 degrees Celsius. One can dress for the cold, but wind at that temperature is just too much. You hands freeze into numbness in no time. This makes me say "NOESS FAIR!" in lolcat style.

image

Despite this, I manage to take a short walk one day. The pictures below are uploaded full size as they came out of the camera without any sort of out of camera processing. The quality of the images is impressive, take a closer look.

IMG_0670

Sunset over the Dunn meadow, Bloomington, IN.

 

IMG_0633

East wing of Swain Hall, the building that houses the joint Computer Science, Math and Physics library.
Bloomington, IN

Monday, February 11, 2008 6:41:50 PM (Eastern Standard Time, UTC-05:00)  #    Comments [0]  |