Shallow Thoughts

Akkana's Musings on Open Source, Science, and Nature.

Thu, 26 Aug 2010

Painless Panorama Stitching with Hugin

[Hugin panorama] A couple of weeks ago in my Fotoxx article I discussed using Fotoxx to create panoramas.

But for panoramas bigger than a couple of images, you're much better off using the Linux panorama app: Hugin.

Hugin is very impressive, and much too capable to be summarized in a single short article, so I'm planning three. This week's article is a basic introduction: Painless Panorama Stitching with Hugin.

Tags: , , , ,
[ 14:11 Aug 26, 2010    More writing | permalink to this entry ]

Tue, 17 Aug 2010

Fontasia: View and categorize your fonts

[Fontasia: font viewer/categorizer We were talking about fonts again on IRC, and how there really isn't any decent font viewer on Linux that lets you group fonts into categories.

Any time you need to choose a font -- perhaps you know you need one that's fixed-width, script, cartoony, western-themed -- you have to go through your entire font list, clicking one by one on hundreds of fonts and saving the relevant ones somehow so you can compare them later. If you have a lot of fonts installed, it can take an hour or more to choose the right font for a project.

There's a program called fontypython that does some font categorization, but it's hard to use: it doesn't operate on your installed fonts, only on fonts you copy into a special directory. I never quite understood that; I want to categorize the fonts I can actually use on my system.

I've been wanting to write a font categorizer for a long time, but I always trip up on finding documentation on getting Python to render fonts. But this time, when I googled, I found jan bodnar's ZetCode Pango tutorial, which gave me all I needed and I was off and running.

Fontasia is initially a font viewer. It shows all your fonts in a list on the left, with a preview on the right. But it also lets you add categories: just type the category name in the box and click Add category and a button for that category will appear, with the current font added to it. A font can be in multiple categories.

Once you've categorized your fonts, a menu at the top of the window lets you show just the fonts in a particular category. So if you're working on a project that needs a Western-style font, show that category and you'll see only relevant fonts.

You can also show only the fonts you've categorized -- that way you can exclude fonts you never use -- I don't speak Tamil or Urdu so I don't really need to see those fonts when I'm choosing a font. Or you can show only the uncategorized fonts: this is useful when you add some new fonts to your system and need to go through them and categorize them.

I'm excited about fontasia. It's only a few days old and already used it several times for real-world font selection problems.

If you want to try it, it's here: Fontasia: View and categorize fonts.

Tags: , ,
[ 11:20 Aug 17, 2010    More programming | permalink to this entry ]

Thu, 12 Aug 2010

Fotoxx: the Greatest Little Linux Photo Editor You've Never Heard Of

Dave stumbled on a neat little photo editor while tricking out his old Vaio (P3/650 MHz, 192M RAM) and looking for lightweight apps. It's called Fotoxx and it's quite impressive: easy to use and packed with useful features.

So I wrote about it in this week's Linux Planet article: Fotoxx, the Greatest Little Linux Photo Editor You've Never Heard Of.

At first, I was most impressed by the Warp tool -- much easier to use than GIMP's IWarp, though it's rather slow and not quite as flexible as IWarp. But once I got to writing the article, I was blown away by two additional features: it has an automatic panorama stitcher and an HDR tool. GIMP doesn't have either of these features, at all.

Now, panorama stitching used to be a big deal, but it isn't so much any more now that Hugin has gotten much easier to use. (My article in two weeks will be about Hugin.) Fotoxx isn't quite that flexible: it can only stitch two images at a time, and can't handle images with a lot of overlap. (But Hugin has some limitations too.)

But HDR -- wow! I've been meaning to learn more about making HDR images in GIMP -- although it has no HDR tool, there are plug-ins to make it a bit easier to assemble one, just like my Pandora plug-in makes it a little easier to assemble panoramas. But now I don't need to -- fotoxx handles it automatically.

I won't be switching from GIMP any time soon for regular photo editing, of course -- GIMP is still much more flexible. But fotoxx is definitely worth a look, and I'll be keeping it installed to make HDR images, if nothing else.

Tags: , , , ,
[ 14:44 Aug 12, 2010    More writing | permalink to this entry ]

Sun, 08 Aug 2010

Can you read this?

[Can you read this?]

Got this in the mail. Awfully thoughtful of them, don't you think? I'm sure all the people who can't read it will call right away.

Tags:
[ 20:00 Aug 08, 2010    More humor | permalink to this entry ]

Sat, 31 Jul 2010

Bogus statistics on drug use among drivers

The "Roadshow" column in yesterday's Merc had some pretty ... odd ... statistics involving marijuana and driving.

It quotes "an NHTSA report" as saying:

contrary to popular belief, marijuana has been found to play a significant role in car accidents across the United States, with as much as 33 percent of drivers arrested at the scene of the accident being positive for marijuana and another 12 percent testing positive for marijuana and cocaine. Every year, 28 percent of drivers in the U.S. will attempt to drive within two hours after ingesting alcohol or illicit drugs. Marijuana is the drug used most often — 70 percent — by drivers who drove after drug use and is a major factor why crashes are the leading cause of death for American young people.

Whoa. Let's play that back again: 45 percent of all drivers arrested at accident scenes (33 plus another 12) test positive for marijuana? Nearly half?

Mr. Roadshow, you don't really believe that number, do you?

I didn't. So I did some searching, looking for the NTHSA source.

When I searched for large portions of the quoted phrase, I didn't find anything from the NHTSA. The Roadshow quote appears to come from an article on friendsdrivesober.org (I'm sure that's an unbiased source). Here's their MS Word file or Google's cached HTML version). The same article is also available as a PDF at prevnet.org and there are lots of other pages making reference to it.

The friendsdrivesober.org article cites "Brookoff, Cook & Mann, 1994; Sonderstrom, Dischinger, Kerns & Trillis, 1995." for the 33% number. There's no citation offered for the "28% will attempt to drive...". They credit "NHTSA, 2000" for "Marijuana is the drug used most often ... by drivers who drove after drug use", but that one's not important because it says nothing about prevalence in accidents, merely that it's used more often than other drugs (no surprise there).

The NHTSA weighs in

Googling on a more general set of terms, I found my way to a October 2000 NHTSA report, Field Test of On-Site Drug Detection Devices. It's a roundup of many different studies, with drug use numbers all over the map, though none larger than the 33% figure and certainly nothing near 45%. That 33% figure is near the bottom:

Brookoff et al. (1994) used on-site testing devices in a study that found a 58% prevalence rate for drugs in subjects arrested for reckless driving (who were not found to be impaired by alcohol). The Brookoff team found that 33% of their sample tested positive for marijuana, 13% for cocaine, or 12% for both. (Because of sampling flaws in the study, these drug test rates should not be interpreted as drug prevalence rates for reckless drivers.) Interestingly, the on-site device (Microline) used by Brookoff and his colleagues generated a significant false positive rate for marijuana when compared to GC/MS results.

The horse's mouth

So what about the original study? I wasn't able to find Dischinger, Kerns & Trillis, but here's Brookoff et al. at the New England Journal of Medicine: Testing Reckless Drivers for Cocaine and Marijuana (cookies required).

A couple of important notes on the study: the figures represent percentage of drivers arrested for "reckless driving that would constitute probable cause to suspect intoxication by drugs", who were not considered to be under the influence of alcohol, and who were suspected of being under the influence of marijuana or cocaine ("all patrol officers were told that they could summon [the testing van] if they stopped a person suspected of driving recklessly under the influence of cocaine or marijuana"). Morover, not all drivers consented to be tested, and the percentages are only for those who were tested.

Seems like a perfectly valid study, as far as it goes (though there's been some mild criticism of the test they used). It's mostly interesting as a study of how marijuana and cocaine use correlate with visible intoxication and sobriety test results. It's not a study of the prevalence of drugs on the road: the NHTSA report is right about that. The numbers it reports are useless in that context.

So the jump from that study to what friendsdrivesober.org and Roadshow implied -- that 45% of people involved in car accidents test positive for marijuana -- is quite a leap, and attributing that leap to the NHTSA seems especially odd since they explicitly say the study shouldn't be used for those purposes.

What really happened here?

So what happened here? Brookoff, Cook, Williams and Mann publish a study on behavior of reckless drivers under the influence of drugs.

NHTSA makes a brief and dismissive reference to it in a long survey paper.

Then friendsdrivesober.org writes an article that references the study but entirely misinterprets the numbers. This study gets picked up and referenced by other sites, out of context.

Then somehow the paragraph from friendsdrivesober.org shows up in Roadshow, attributed to the NHTSA. How did that happen?

If you look at the friendsdrivesober.org article, the paragraph cites Brookoff in its first sentence, then goes on to other unrelated claims, citing an NHTSA study at the end of the paragraph. I suppose it's possible (though hard to understand) that one could miss the first reference, and take the NHTSA reference at the end of the paragraph as the reference for the whole paragraph. That's the best guess I can come up with. Just another example of the game of telephone.

Nobody with any sense thinks it's a good idea to drive under the influence of marijuana or other intoxicants. But bogus statistics don't help make your point. They just cast doubt on everything else you say.

Tags: , , ,
[ 12:33 Jul 31, 2010    More headlines | permalink to this entry ]

Thu, 29 Jul 2010

How to save on modeling fees

[Terrible's ad] At the Terrible's Sands Regency in Reno, Dave noticed this ad on the table in the room. "Wait -- isn't that the same guy, twice?"

Sure enough -- not just the same person, but the same photo, with different hair and neck pixeled in.

I guess Photoshop/GIMP artists are cheaper than photo models these days.

We spotted the same model in other ads around the hotel, sometimes masquerading as other races as well.

Tags: , ,
[ 16:28 Jul 29, 2010    More gimp | permalink to this entry ]

Wed, 28 Jul 2010

The Case of the Missing Gooseberry

Traveling always comes with risks. Aside from the risks you may encounter along the way, there are the worries of what you left behind. Will the house burn down? Will the mail pile up, signalling to thieves that the home is empty? Will the server stay up? On a more prosaic note ... Will the plants in the garden all die from lack of water?

Shortly before traveling to Oregon for OSCON, I acquired a cute little Cape Gooseberry seedling (courtesy of Mark Terranova at the south bay Geeknic). That's a new plant to me -- I'd never seen one before. But it was a cute little thing, and seemed to be flourishing. I had it in a pot on a little shelf where it would get morning sun but wouldn't get too hot in the afternoon, and was looking forward to planting it when it got big enough to withstand our marauding local seedling-loving snails.

[ Missing Cape Gooseberry ] To get it through my planned week-and-a-half absence, I had one of those glass watering bulbs they sell in drugstores. They're supposed to last several weeks, though they don't work that reliably in practice. Still, I saturated the soil with water the morning I left, then filled the bulb and crossed my fingers for no long heat waves.

I wasn't prepared for what I saw when I got back. Something had dug out my little gooseberry and taken it!

I still have no idea what got it. We certainly have some local squirrels who love to dig, and young squirrels (still learning their digging skills) love potted plants. But I wouldn't think a squirrel would have much use for a gooseberry seedling -- they just like the act of digging.

I wonder if cape gooseberry leaves are particularly tasty to rodents?

Ironically, the soil was still quite damp. The little plant probably would have made it through just fine.

Tags: ,
[ 13:17 Jul 28, 2010    More travel | permalink to this entry ]

Wed, 21 Jul 2010

Writing scripts for your Canon camera with CHDK

On Linux Planet yesterday: an article on how to write scripts for chdk, the Canon Hack Development Kit -- Part 3 in my series on CHDK.

Time-Lapse Photography with your Inexpensive Canon Camera (CHDK p. 3)

I found that CHDK scripting wasn't quite as good as I'd hoped -- some of the functions, especially the aperture and shutter setting, were quite flaky on my A540 so it really didn't work to write a bracketing script. But it's fantastic for simple tasks like time-lapse photography, or taking a series of shots like the Grass Roots Mapping folk do.

If you're at OSCON and you like scripting and photos, check out my session on Thursday afternoon at 4:30: Writing GIMP Plug-ins and Scripts, in which I'll walk through several GIMP scripts in Python and Script-Fu and show some little-known tricks you can do with Python plug-ins.

Tags: , , , , , ,
[ 09:31 Jul 21, 2010    More photo | permalink to this entry ]