Wednesday, April 29, 2009

Not a lot of money

From CNN:
White House press secretary Robert Gibbs said ordinary Americans would nevertheless appreciate the savings effort.

"Only in Washington, D.C., is $100 million not a lot of money. It is where I'm from. It is where I grew up. And I think it is for hundreds of millions of Americans."
Actually, for hundreds of millions of Americans, $100 million is less than one dollar each.

Just saying.

Tuesday, May 13, 2008

Tech talk on threads in C++

Video of a Google tech talk: Advanced Topics in Programming Languages Series: C++ Threads.

Slightly interesting, with a lot of boring details that don't make sense to me because I don't do C++. Then, at about 1:19: "what we really need is, basically, an anonymous nested function. Something like out of Pascal."

WTF??!!!

Wednesday, April 23, 2008

$100 fill-ups arrive at gas pumps - CNN.com

CNN.com reports that gas prices are over $4 a gallon in some places, yielding $100 fill-ups for a van towing a horse trailer. And you know what?:
A person making $9 an hour needs to work nearly seven hours just to pay for 15 gallons at $4 a gallon, according to CNN.com's gas calculator.


And in a related story, Texas Instruments confirmed that 15 times 4 divided by 9 is nearly 7. Hewlett-Packard and Casio could not be reached for comment.

Honestly, people. A web applet that answers the question "How long do you have to work to earn enough to fill your gas tank?" is a cute idea, but this is the kind of math that high school graduates need to be able to do, or at least check, for themselves. We should not have to appeal to the numerical expertise of the Flash developers at CNN.com.

News flash! According to CNN.com's gas calculator, I "need to work 1.74 hours to afford one tank of gas." If you'll excuse me, I have to go ask my 12-year-old cousin for a soundbite on how many minutes that is.

Wednesday, April 16, 2008

Right Fight, Wrong Word

New York Times blogger Dan Schnur says Obama's mistake was saying "cling", not saying "bitter":

Both the Clinton and McCain campaigns focused on the word “bitter” — allowing Senator Obama’s supporters to engage in a largely semantic discussion about whether economically disadvantaged Americans were “bitter” or “angry” or “frustrated.” But this is a meaningless series of distinctions even in this super-charged political environment. It’s safe to say that people without jobs are not particularly happy about that situation, regardless of the adverb in question.


Someone alert Geoffrey Pullum. "Bitter", "angry" and "frustrated" are not adverbs. Wrong word, indeed. Oh, well. Read it anyway.

Tuesday, January 15, 2008

Philip Dunn ansers the question I would have asked

On his blog, photoactive, pro photographer Philip Dunn answers a question about manual exposure from a former student that addresses exactly the issue I ranted about two posts ago:
When you are using an automatic exposure mode such as Aperture Priority, ... every time you make an adjustment to the your framing of your composition the chances are that the exposure will change as the metrering system reads from a different area of the subject.

This is precisely why I cannot be bothered with auto settings.

I want to take my reading from the area of the subject I choose and for that exposure not to change when I re-frame the picture.
To keep this in perspective, Dunn also wrote the following, in the tutorial on manual mode he posted this Sunday:
Never let setting the exposure get in the way of capturing the moment. ... If you think you are going to miss a picture – revert to Auto Exposure mode. It’s the picture that matters, not the way it’s exposed.

To summarize, I was more or less on target when I said that the right reason to use manual mode is that you think the lighting conditions affecting your subject are unlikely to change quickly between shots, and that auto mode is justifiable when this is not the case.

Philip Dunn, being a highly experienced pro, advocates practicing with M mode until you are fast enough with it to use it most of the time. ("You will be surprised how quickly you will be able to set your exposures manually.") I'd say that's a matter of taste, except that his "taste" is the result of years of success taking pictures, while mine is the result of not having had years of success taking pictures. You figure it out.

Photo: Infected Waxworm


Waxworm
Originally uploaded by C Joe V
Here's the story of this picture. Elissa has been studying Heterorhabditis bacteriophora for about two and a half years now, and by last November had decided she really would like some pictures illustrating its life cycle that she could use in presentations, papers and whatnot. Up to now, she had been using images borrowed from another lab.

When she asked if I could take some pictures for her, I said I didn't think either of the lenses I own would give enough magnification. A decent macro lens would cost almost $500, which was too much to justify for just a couple of little pictures of worms. But there was another option: close-up lenses that screw onto the filter threads of any lens. I indicated that if I were to receive a set of these for Christmas, I would probably be able to take some close-up pictures of her little animals.

I need to clarify something here. H. bacteriophora is a tiny worm -- you need a microscope to see them as anything other than little white specks. What we needed to take pictures of were the moth larvae (wax moths, Galleria mellonella to be specific) that served as hosts for the tiny parasitic worms. The moth larvae are maybe a couple of centimeters long.

Lo and behold, I did get a set of close-up filters for Christmas (guess from whom!), so one day in early January we took almost all the photography equipment I own into her lab to try them out.

First we took some shots of a long-since dead and rather disgusting carcass of a waxworm, in a puddle of clear liquid teeming with the aforementioned little white specks that had killed it. Those were long exposures, since nothing was moving. We killed the fluorescent lights so that the subject would be side-lit by the windows on the other side of the room. Those pictures were pretty gross, but Elissa was happy with them.

The photo above is one of a much healthier waxworm, which had only been infected with the parasites 24 hours before the photo session. Since this one was alive, and crawled around on the posing surface, I had to use flash. Here's the setup: camera, with 50mm f/1.8 lens and some combination of Hoya HMC close-up filters that gave an appropriate magnification, mounted on a tripod with inverted center column looking straight down at the subject; SB-600 flash on-camera, set to TTL with some negative compensation (because the background was black -- but that turned out to be a mistake, as the pictures were all underexposed). I used a fast shutter (1/200, if I remember...) and small aperture (f/8, maybe) so that we could safely turn the room lights back on. The camera was too close to the subject for the flash to light it evenly, so I set up a piece of flexible craft foam (as in A Better Bounce Card) around the non-flash side of the worm and bounced light onto it as best I could with a piece of white paper on the other side of the flash.

I shot in RAW+JPEG mode; the picture you see is the result of processing the RAW file with RAW Therapee and a bit of Photoshop. The JPEG was not usable because I had set the flash exposure too low.

Elissa and I were both fairly pleased with the results.

As a final note, the image you see here is one of the rejects, in case Elissa needs to use the good one in an article in a copyrighted journal. Normally, I follow the Computer Science community in civilly disobeying copyright restrictions on scientific literature when I am the author, but this is not CS and I'm not the author here.

Friday, January 11, 2008

Manual Exposure

Recently on photo.net I read yet another discussion forum thread on the question of manual versus auto exposure modes. Usually these threads are a newbie asking what mode to use, and the answers from seasoned pros vary from "who cares, use whatever you like" to "I always use manual because that's what I learned in the Stone Age" to "unless you use manual mode you are a mere snapshooter, not a photographer." (Those are paraphrases.)

The vast, vast majority of people in these discussions are missing the point, which is this: Modern cameras have meters. And except for people who really did learn photography in the Stone Age and are very comfortable with their skills, people use them. We rely on these electronic devices to measure light, because the perceptions of light levels we're fed by our eyes and brains are just not accurate enough to set a digital camera by. The only difference between manual exposure and non-manual exposure is the interface by which we choose to communicate our desires to the camera.

I agree somewhat with the sentiment that a "real photographer" is distinguished from a "mere shapshooter" partially by the fact that she or he pays attention to the technical aspects of what is going on rather than just aiming the camera and pressing the shutter button. I take issue, though, with the way people apply this notion. Stone Age photographers think understanding what's going on means knowing what aperture and shutter speed you want and telling the camera to use them. Digital Age photographers understand, or should understand, that it really means knowing as much as you can about how your camera works, and using that knowledge to make it do what you want in an efficient and reliable way.

In my efforts at learning digital photography, I have discovered two things: first, all exposure modes are equivalent; and second, all exposure modes are not the same. After elaborating on the former at some length, I will explain the latter.

In the digital era, cameras have three canonical exposure parameters: aperture, shutter speed, and ISO. And pretty much every camera that has a Manual mode (in which the photographer dials in all three of these) also has a Shutter priority mode (labeled S or Tv on the mode dial), an Aperture priority mode (A or Av) and a Program mode (P). The choices you get besides these will differ between cameras, so never mind them. There are two big things that many people seem to miss: First, in every single one of these modes, including Manual, you are probably relying on the camera's meter to almost exactly the same extent. Second, on many if not most digital SLRs, in every single one of these modes you have independent control over all three of the canonical exposure parameters.

I'll elaborate that second one first. In all four modes (M,S,A, and P) you get to set the ISO. And in each of the four modes (with the possible exception of P on some cameras) you have two other inputs that control the exposure. So you have three parameters that need setting, and you have three degrees of freedom in your control of the camera. This means that within certain limits, you can always get the ISO, shutter speed and aperture you want.

In M mode, you set aperture and shutter speed.

In S mode, you set shutter speed and exposure compensation.

In A mode, you set aperture and exposure compensation.

In P mode (on many or most camera bodies), you set exposure compensation and program shift.

So suppose you somehow know that you want to take your next shot at ISO 400, 1/250s at f/5.6. Set your camera to ISO 400, and then you have four choices. Go into M mode and set the shutter speed to 1/250 and the aperture to f/5.6; or go into S mode and set the shutter speed to 1/250 and adjust the exposure compensation until the camera chooses f/5.6 for the aperture; or go into A mode, set the aperture to f/5.6 and adjust the exposure compensation until the camera chooses 1/250 for the shutter speed. In P mode it's a bit harder to describe how to get what you want, but trust me, if you move the exposure compensation and program shift controls around enough you'll eventually be able to get the camera to choose both 1/250 and f/5.6 as long as this is not too radically different from what the camera would have chosen in Auto.

Therefore, if you happen to know what aperture and shutter speed you want, you can get them in any of the four modes. Of course, human beings almost never know what aperture and shutter speed they really want, because we're bad at measuring light levels by eye. So under most normal circumstances you're going to let the camera's light meter measure the amount of light in the scene for you.

Assuming you trust the meter, what do you do? If you're in P mode, with the exposure compensation set to zero, the camera will measure the amount of light coming through the lens and choose an aperture and a shutter speed for you. If you're a casual snapshooter or are in a hurry, you can just press the button. On the other hand, if you take the time to look at the parameters the camera has chosen and don't approve of them, you can use program shift to override them. But notice: if you keep the ISO the same, then for any given aperture there will be at most one shutter speed that gives the correct exposure, and vice versa. If you want a particular f-stop, you watch the aperture as you turn the program shift dial; when the f-stop you want is displayed, you take the picture and the camera uses the right shutter speed. Similarly, if you want a particular shutter speed, you watch the shutter speed display as you turn the dial, and when you see the number you want, you take the picture. What if you choose the shutter speed you want and then notice the camera has chosen an aperture you don't like? Well, tough luck -- that's the aperture you need to use in order to let in the right amount of light for the brightness of the scene as measured by the meter (which, for now, we assume you trust), unless you change the ISO. So you may end up looking for a compromise, using a slower shutter speed than you thought you wanted in order to get enough depth of field, or a larger aperture than you thought you wanted in order to freeze motion, or whatever.

What happens in A or S mode? The exact same thing! If you're in A mode, you adjust the aperture directly, and as you do so, the camera follows you by changing the shutter speed in the opposite direction to keep the overall exposure in line with the brightness of the scene. So if there's a particular f-stop you want, you adjust the aperture until you see it, and if the corresponding shutter speed is okay with you, you take the picture. Conversely, if there's a particular shutter speed you want, you can just watch the shutter speed display while you adjust the aperture, and when you see the speed you want, if the aperture you had to set in order to get it is okay with you, you take the picture. If you set one parameter and the camera chooses a value for the other that you don't like, you look for a compromise. In other words, the aperture dial in A mode does the exact same thing as the program shift dial in P mode. The same is true of the shutter speed dial in S mode.

Now for M mode. M mode is "manual" in the sense that after you've set one parameter (aperture or shutter speed) it's also your responsibility to set the other one. Naturally, you use the meter to do this. Maybe you think you know what f-stop you want, so you dial it in using the aperture control; now you must set the shutter speed to get the right exposure. Looking at the "meter" in the viewfinder, you turn the shutter speed dial until the needle is centered, pointing to zero. When that happens, you know you've set a combination of parameters that will provide the amount of light the camera's metering circuits think is appropriate. Since we're still assuming you believe the meter's analysis of the scene, all you have to do is make sure the shutter speed you've selected is acceptable, then shoot. Similarly, if you start out thinking you know what shutter speed you want, you dial that in first, adjust the aperture until the meter reads zero, check that the aperture you've arrived at is okay with you, and shoot. If, after setting one parameter, you find that the value of the other one that centers the needle is too high or too low, you still have to look for a compromise just as in the other modes, except now you are responsible for changing both settings to find a pair that works for you and centers the needle.

It would seem, then, that a major difference between manual and non-manual modes is that in non-manual modes the camera won't let you choose a combination of aperture and shutter speed that disagrees with the meter, but in manual mode you can do anything. That's not quite true, though.

Suppose you look at the scene and say to yourself, "I know from experience that my camera's meter will think this scene is brighter than I think it is." Maybe you're taking a picture of somebody who's backlit by the sun, and you think the camera will pay more attention to the bright sky than to the face that's in shadow. Or maybe you're taking a picture of a polar bear on a glacier, and you think the camera will mistake the white subject and white background under an overcast sky for a gray subject and gray background under full sun. In either case, you are going to want to let more light into the camera than the meter will tell you to. It's not hard to see how to do this in M mode: everything is the same as before, except that rather than finding a combination of settings that centers the needle at zero, you will look for a combination that puts the needle somewhere above zero. If you're taking a picture of a black bear in a cave, you'll be placing the needle below zero. Naturally, it is up to you to decide how far above or below the camera's recommendation you want to place the exposure.

This may sound like the kind of elite hackery that can only be done in manual mode, but of course it is not. Making this kind of adjustment in A, S and P modes is the entire point of exposure compensation. All you need to do is guess how far off you think the meter's recommendation will be. For instance, if you're in A mode and you think the meter will tend to underexpose by, say, one stop, you set the exposure compensation to +1, then adjust the aperture as before, watching the shutter speed, until you find an acceptable combination. S and P are analogous.

Thus we've returned to a point I claimed earlier: no matter what mode you're in, you need to know whether you think the meter is misunderstanding the scene, in what direction, and by how much. You can do this by guessing, or (in the Digital Age) you can do it by taking a test shot and reading the histogram. Regardless, using the auto modes does not excuse you from thinking about metering, nor does manual mode force you to think about it significantly more. They are the same.

Well, almost. The exposure compensation on most cameras is only settable from -2 to +2, or from -3 to +3, depending on configuration. So non-manual modes do confine you to working within 2 or 3 stops of the meter's preferred exposure level, while manual mode does not. But honestly, would the camera maker only give you a meter that reads from -3 to +3 if they thought you would be working outside that range very often?

So much for why all exposure modes are equivalent. How are they different, and what should you use?

My implicit assumption when arguing that all modes are equivalent was that you are only taking one photograph at a time: you set the exposure parameters once, click the shutter once, and start over from the beginning. Real life is not like this: you adjust some settings, shoot a few frames, adjust some more, shoot some more, and all the while you must pay attention to what is going on around you. The more you need to concentrate on composition, lighting, timing and focus, the less attention you will be able to give to exposure. This is where taking advantage of your modern, highly automated camera can help you.

The difference between M, A, S and P modes is how control over the image is divided between you, the camera, and The World. The only real reason this is important is that things you control will remain fixed from one shot to the next until you take the time to change them.

In all modes, The World controls the amount of light available for making a picture. In non-manual modes, the camera has enough control over the exposure that it can react to changes caused by The World, keeping the image consistent without your having to do anything. In manual mode, the camera stays out of it and if The World suddenly gets brighter or dimmer, so will the image you record.

If you believe that The World is unlikely to change from one shot to the next, then any difference in levels as measured by the meter is probably misleading. Thus, you should choose M mode so the camera does not mess up the images by compensating for "changes" that aren't really there.

If you believe that The World is likely to change very fast -- if there are clouds moving past the sun, or you're moving from sun to shade, or you're walking around a room with big windows at one end and dark corners at the other -- then you may want the camera to react to these changes so you don't have to. Thus, you should choose some mode other than M.

Which auto mode to use when using an auto mode? That depends on which exposure parameters you want to hold fixed until you change them. If you're shooting a waterfall on a partly cloudy day, you might use S mode so that when the sun goes behind a cloud, the camera will react by changing the aperture rather than messing up your carefully chosen shutter speed. If you're shooting a landscape, or an extreme close-up, you might want to use A mode so the camera's automatic adjustments won't affect your depth of field. If you're running around after your 2-year-old, you may want to use P mode, giving the camera permission to speed up the shutter when you're in the sun but also to open the aperture when you're in the shade.

None of this makes you any less of a photographer. Anyone who says it does is stuck in the Stone Age. What makes you a photographer is that you know what you want, and you get it.

Wednesday, January 09, 2008

Every four damn years...

...I find something to hate about the way the news media handle presidential elections. And usually I find something to hate about the way the candidates and their parties handle them.

This year it's the fact that the media seem to have the nominating conventions confused with the Electoral College. They're nothing alike. In the national election for President, electoral votes are (for the most part) racked up one whole state at a time. So a victory in (say) Florida for the Republican candidate shifts the electoral vote in the Republican's favor by 27 votes, which is 5 percentage points, no matter how tiny the margin was in Florida.

Primaries are different. The pledged delegates from each state are divided between candidates according to the candidates' shares of the state's primary or caucuses. That means that if the top two candidates in (say) the Democratic primary in New Hampshire get very different numbers of votes, they get very different numbers of pledged delegates, but if the race is close and they end up with nearly equal numbers of votes, they get nearly equal (or even exactly equal) numbers of pledged delegates. Sure enough, according to CNN's Election Center 2008, Barack Obama's "huge" eight-percentage-point win in the Iowa caucuses gave him 16 pledged delegates, with 15 going to Hillary Clinton and 14 to John Edwards. (And clearly there's even more to it than I know about, because that is not even the same relative order as the popular vote.) Hillary Clinton's two-percentage-point win in the New Hampshire primary gave her and Obama 9 each and Edwards 4.

That's right. In terms of pledged delegate count, Obama came out of Iowa with literally the smallest possible lead over Clinton, and New Hampshire was a tie. That leaves Obama one pledged delegate ahead of Clinton, and Edwards the only one of those three who's in any kind of trouble. Meanwhile, Mitt Romney, with his "two silvers and one gold", actually leads the Republican field, because Iowa winner Mike Huckabee did poorly in New Hampshire and New Hampshire winner John McCain did poorly in Iowa.

Aside: Note how I keep saying "pledged delegate" rather than just "delegate". If you count Democratic superdelegates, who are individual people that get to vote at the convention as if their opinions were as valuable as those of thousands of ordinary citizens, Hillary is evidently ahead, with 183 predicted convention votes to Obama's 78 (as of today). I guess this reflects her status as the "establishment" candidate. So all non-Hillaries have a deficit to make up, but unlike the margins you see while watching returns on election night, this one can not increase proportionally as more and more precincts' votes are counted.

With the nomination process barely out of the starting gate, Obama and Clinton are neck and neck, Edwards is still in it, and Romney leads the pack of Republicans. So say the numbers, so say I. But noooo. In the perverted calculus of political news reporting, every caucus and every primary must have one candidate declared "the winner", with all others "losing" (and obliged to "concede" on national television) and the ranking of nonwinning candidates considered more important than their share of the vote. This is reasonable in the winner-take-all general election, but it is bogus and misleading in the primaries. There is tons more that I hate about politics, including the fact that my favorite candidates almost never win, but this is a case where most of the reporting and commentary is just plain stupid.