Observation 54385: Cortinarius caperatus (Pers.) Fr.
When: 2010-09-19
No herbarium specimen

Notes: in rainforest at ~4000’ near Sitkum Creek

Proposed Names

Please login to propose your own names and vote on existing names.

Eye3 = Observer’s choice
Eyes3 = Current consensus

Comments

Add Comment
simple scale bars
By: Chris Parrish (kitparrish)
2010-10-10 15:52:55 CDT (-0400)

A. For a photo with adequate exiftool data

A1. Look up scale bar length in pixels in the calibration table for that camera + lens

A2. There is an example of such a calibration table lower down in this chain of messages

B. For two photos that share two points, P and Q, and one of the photos has a ruler in it

B1. Measure the length in pixels of a 1 cm segment of the ruler, rulerPixelsPerCM
This is the length in pixels of a 1 cm scale bar for that photo

B2. Measure the length in pixels between P and Q in the ruler photo, rulerPQ
Measure the length in pixels between P and Q in the new photo, newPQ
The length in pixels of a 1 cm scale bar for the new photo is
(newPQ / rulerPQ) * rulerPixelsPerCM

C. Use a graphics program or Jason’s gimp plug-in to draw a scale bar of the proper length

scale bar added by jason’s script!
By: Chris Parrish (kitparrish)
2010-10-09 15:29:03 CDT (-0400)

gimp scale-bar plug-in
By: Jason Hollinger (jason)
2010-10-09 07:02:37 CDT (-0400)

I wrote a Gimp plug-in, and tested it extensively on the photos from my two-week hike on the northern end of the PCT last month in which I have already added scale-bars by hand — it works remarkably well! I’m so stoked. This will not only save me loads of time, but it is likely more accurate than what I was doing before.

It currently only supports my Casio EX-Z1080. You/we will need to do the calibration for other cameras. In particular, the way I’ve written it, you will need to fit a 4th-order polynomial relating inverse scale (cm per pixel) to subject distance (as reported by exiftool). But given these three coefficients and intercept, it should in theory work for any camera.

If you want, just send me, say, 10 to 20 photos of a ruler at distances varying from as close as you can to up to 5m, taken at typical aperture, no zoom. (Use of zoom adds another variable we haven’t considered yet.) I can calculate the calibration and add support for your camera to the script.

Just place my python script in /home/user/.gimp-2.6/plug-ins. I’ve reassigned ctrl-S to run it for me, otherwise look for it at the bottom of the Edit menu. It places a scale-bar of the desired length in any of the four corners of the image. If you press ctrl-dot a few times afterwards, it will darken the background a bit behind the ruler, as well.

I’m posting the script here until I can find a better home for it:

http://bornnaturalist.org/gimp/scale-bar.py

Please let me know if anyone ends up trying it out. Thanks!

getting close …
By: Chris Parrish (kitparrish)
2010-10-08 19:21:02 CDT (-0400)

to user-friendly scale bars using a well-known shareware program called GraphicConverter on a Mac. The operations are so basic that they could probably be done by any number of graphics programs.

1. Open the full-sized jpg image in GraphicConverter (3888 pixels wide for a certain camera).
2. Use Show Information to get the exiftool data on Focal Distance for that photo (say, 90cm for a certain example)
3. Find appropriate scale bar length for that distance from your calibration table (239 pixels, in this case)
4. Select Position to display the cursor’s position, Toolbox to get the tools panel, Line for the line tool, hold down the Shift key to draw a straight horizontal line, and draw a horizontal line 239 pixels long (watch the little Position box to know how long your line is as you draw it).
5. Select the Text tool and write “1cm” just above the scale bar. Use the Pointer tool to fine adjust the position of that text.
6. Save the image.

All this takes less than a minute after a bit of practice. Jason’s idea of automating some of this would be wonderful … just drop a generic white bar on an image and stretch it to the right length.

sorry about the deluge of comment notifications!
By: Jason Hollinger (jason)
2010-10-08 16:20:11 CDT (-0400)

I’m fairly confident that a handy plug-in could be written for both Photoshop and Gimp which would read the appropriate info from the EXIF header and create a scale-bar as a transparent layer on top of the image. You could then drag this layer around to a convenient spot, optionally reversing the color. Could even add a weak shadow behind it to help it stand out (I already have a macro that does that for me once I’ve loaded the appropriate scale-bar layer). Anyone good with writing PS or Gimp plug-ins?? I’m still very much a rank beginner.

I could also imagine a handy little Windows (or Mac?) program that, using ImageMagick and exiftool, could slap a scale-bar in some fixed part of the image, say, by dragging and dropping images on an icon? I’m definitely not a Windows guy, though, so I don’t know how such interfaces work.

needless
By: Danny Newman (myxomop)
2010-10-08 05:24:48 CDT (-0400)

to say that I’ve gotten a fair bit more than I bargained for in my initial proposal to illicit more information on this technique. All of it has been fascinating (if a bit over my head, namely the physics element). I’d love to see some simplified system come of this conversation that allows the lay photographer to make use of such a valuable tool. photographs can convey a great deal, to be certain, but scale often goes unexpressed without something actually in the frame to serve as a point of reference. I’d be overjoyed to be able to make use of an easy, approachable, user-friendly system for expressing scale easily in every photo. thanks to everyone for your contributions on this observation and the topic at large.

Lots of progress on this page
By: Chris Parrish (kitparrish)
2010-10-07 17:48:49 CDT (-0400)

1. an efficient procedure for calibrating a camera + fixed focal length lens,
2. exif data right on the photo reporting distance from sensor to target,
3. a simple formula for the length of scale bars for close-ups,
4. and a fairly high degree of confidence in the length of those scale bars over the most relevant distances for close-ups (say < 1.2 m or so).

Now I’m working on the final step:
5. use gimp to draw the scale bar

well done!
By: Jason Hollinger (jason)
2010-10-07 15:02:19 CDT (-0400)

It’s so obvious when you look at the plot, isn’t it? So it does follow a relation of the form we expect:

M ~ 1 / (f – So)

or alternatively,

1/M ~ f – So

It’s just that f isn’t even close to what it should be. It should be the focal length, which for my camera should be 7.9 mm; instead I find it is -0.0072 mm. Also, I need to cut off the points for So > 1m, because something screwy starts to happen out there. (But that also makes sense, because field of view becomes infinite somewhere around 5-10 m even at largest aperture. Finally, note that according to the formula, M should be negative, which just means that the image should be inverted. Note that this is the formula for a “simple, thin lens”; clearly my lens is emphatically not “simple”.

(Note that R-squared for the fit — after removing the points with So > 1 m — is 0.995.)

Thought we were done, but not quite
By: Chris Parrish (kitparrish)
2010-10-07 09:56:25 CDT (-0400)

Plot cm / pixel, instead of pixels / cm. One can probably find some similar triangles and simple geometry lurking here.

empirical
By: Chris Parrish (kitparrish)
2010-10-07 01:02:32 CDT (-0400)

Totally empirical at this point. I don’t understand the optics of it at all. A Hubble Space Telescope Lichen Camera could watch my little ruler retreat for ages, and the image of it would still take up a few pixels, so the function has to be asymptotic to 0 as x → infinity. Good candidates are 1/x and e^(-x). Also, light rays from both sides of the lichen cross each other inside the camera somewhere in front of the sensor, so we might expect a formula involving x-x0, rather than just x.

On the other hand, once a camera + fixed focal-length lens is calibrated like this (which takes perhaps 20 minutes for shooting the photos and making a table of numbers) the exif distance seems to be a fairly reliable guide for subsequent photos (for short distances) for indexing into the distance table to produce a reasonable scale bar length. Cool!

show off!
By: Jason Hollinger (jason)
2010-10-06 23:38:46 CDT (-0400)

Very nicely documented! I see that your data is also non-linear. More like M ~ So ** -1.5 in your case.

WTF? What am I missing? I’m totally stumped. This makes no sense to me… (Does it need to, though??)

Here’s my data:

dist scale
0.078 3974
0.083 3820
0.086 3674
0.089 3600
0.091 3508
0.092 3580
0.109 3065
0.112 3020
0.159 2234
0.178 2100
0.220 1653
0.303 1231
0.344 1135
0.414 961
0.450 871
0.644 700
0.686 631
0.848 534
1.392 365
2.239 242
5.632 179

(Dist = exiftool’s “Object Distance” in meters; scale is distance between two fixed points in pixels, in this case the width of a business card or ~9.35 mm.)

result
By: Chris Parrish (kitparrish)
2010-10-06 21:12:30 CDT (-0400)

result: 80cm photo with scale bar 274 pixels long (drawn with gimp)

ExifTool Focal Distance vs. measured distance
By: Chris Parrish (kitparrish)
2010-10-06 19:29:44 CDT (-0400)

data
By: Chris Parrish (kitparrish)
2010-10-06 19:10:20 CDT (-0400)

length of a 1cm scale bar in pixels vs. distance from the camera’s sensor to the target, for this camera (images come out of the camera at 3888 pixels wide):

courage! … press on! … it’s Nobel Prize season!
By: Chris Parrish (kitparrish)
2010-10-06 17:30:40 CDT (-0400)

I mean, if Prof. Geim can levitate a frog, we can do scale bars. First there is the issue of an appropriate experimental apparatus ….

I give up
By: Jason Hollinger (jason)
2010-10-06 14:55:30 CDT (-0400)

Empirically M = f / (So – f) doesn’t work, either. I get something closer to M ~ So ** -0.85. I have no idea what my camera’s “object distance” means. But it seems to be consistent, so maybe it is usable.

Have I officially beaten this subject to death yet??

my physics is way rusty!!
By: Jason Hollinger (jason)
2010-10-06 13:49:42 CDT (-0400)

Yikes, I’m still trying to understand how all this stuff works. But I think I’ve found the operative equation… and I understand much better some inherent problems with calibrating your scale bar solely on this one number (object/subject distance).

Magnification is not quite (inversely) linear with respect to this reported distance. I think it is M = f / (So – f) …that is, subtract the focal length first, then it is supposed to be inverse linear. I need to test it on mine again.

Whatever the equation, though, I think if you empirically plot the scale for a reasonable set of subject distances, you should nevertheless end up with a usable approximation.

As for “lower” and “upper focus distance”, this might refer to the depth of field — i.e. the nearest and farthest distance in which things are sharply in focus. That would be cool, because it would allow you to explicitly measure the uncertainty of your scale bar. (Mine definitely does not provide that EXIF information!)

But another thing to keep in mind is depth of field. At infinity the whole concept of a scale bar becomes virtually meaningless, since everything from the camera’s so-called hyperfocus distance to infinity is in focus. That is, there is no narrow focal plane anymore, it is infinitely thick. With my Casio Exilim, if I focus at 1 m with f/2.8 (as large an aperature as I can get, thus narrowest focal plane) I still get a depth of field of 0.6 m (see this supercool on-line DOF calculator.) In particular, things up to 20% closer than the subject are in focus, making the “uncertainty” of the scale bar at least 20%… in the best case.

So my take-home lesson regarding this is that I’m probably not going to be fooling with scale bars at anything farther than a few dozen cm any more. I don’t know, maybe it’s still better than nothing, but it seems to have more potential for confusion than explication!

ExifTool
By: Chris Parrish (kitparrish)
2010-10-06 03:48:51 CDT (-0400)

For a photo taken by a Canon EOS 40D, ExifTool shows “Focus Distance Upper” and “Focus Distance Lower,” so we might have this sort of data for a number of cameras. That suggests a variation on your experiment, Jason. Take 10 photos of a meter rule at 10 known distances (say, out to 1.5m) and make a table of known distances, exif distances, and (using the image of the ruler on the photos) mm/pixel.

EXIF number nontrivial
By: Jason Hollinger (jason)
2010-10-05 13:59:00 CDT (-0400)

I just discovered that my camera now also records something called “Object Distance”, but the mathematical relationship between this number and scale is not linear as I would expect (is my physics rusty??). Still, it’s not hard to estimate a 3rd or 4th-order polynomial to the data (I think Excel or Open Office Calc can do this?). I took 10 photos from 0.078 to 1.235 m away and measured the distance in pixels between two dots visible in all the photos. I would do it again with even more points to improve the error — I was getting 5% error at the 1.2 m end even with a 3rd order approximation. Hopefully your D60 works better!

check your EXIF
By: Jason Hollinger (jason)
2010-10-05 12:58:15 CDT (-0400)

I just looked at a few of your photos, and yes, your D60 does include the information you need. “exiftool” calls it “Subject Distance” (and it even looks accurate :). Couldn’t ask for better!

I use an old Casio Exilim point-and-shoot
By: Jason Hollinger (jason)
2010-10-05 12:50:01 CDT (-0400)

Most cameras these days let you know somehow (flashing lights and/or beeps) when you are trying to focus too close. I cranked the volume all the way up on mine, then start way too close and back away slowly. Each time I half-press the shutter release it flashes silently if I’m still too close. Once I’m finally far enough, it stops flashing and beeps. May seem a bit tedious, but it only takes a few seconds in practice, and not only does it calibrate the photo, but it also ensures that I have maximum detail.

Some cameras let you focus essentially touching the object — those wouldn’t work this way, clearly. But fancy cameras like yours may well give a focus distance or equivalent in the EXIF information. In principle it should be possible to use that calibrate. This would be an ideal method, since you wouldn’t have to pay attention at all in the field, knowing that every picture will automatically have its scale essentially recorded in the header.

Check out exiftool. It’s a free tool that dumps out all the info in the EXIF header. May only be available on unix, but windows and mac typically have even more options. All you’d need is a simple perl script that ran exiftool, grabbed the appropriate number(s), crunched them and spit out the target size of your scale bar.

interesting
By: Danny Newman (myxomop)
2010-10-04 23:26:44 CDT (-0400)

my next question then is: which cameras have such a calibration feature? i’m not aware of any such function on my D60.

image scale bar
By: Jason Hollinger (jason)
2010-10-04 14:57:31 CDT (-0400)

I got the idea from amadej:

I’ve calibrated my camera so that I know how many pixels per mm. The key is to take at least one photo as close as possible to the subject: start too close, then back off until the camera beeps, telling you it successfully got a lock.

I have a tiny transparent image layer that I can then overlay on top of the photo showing the scale. I just move it to some place suitably dark or featureless, sometimes darkening behind it a bit to help it show up. You might need Photoshop (or the roughly equivalent free product called Gimp), because not all image manipulation programs can handle layered images.

You can infer calibration for more distant shots by measuring the distance between shared points in both the close-up and distant shot, then scaling the scale bar layer accordingly.

I calibrated by taking ~10 photos of a ruler in various poses and at various angles. Result is accurate to within about 10%, good enough for these purposes. It’s much more accurate for shots through the microscope or dissecting scope — within 1%… which is to say, as accurate as your ruler or reticle!

(Note, of course, that this scale bar only applies to the focal plane, which is pretty narrow in my photos since my camera only goes down to f8 even in the brightest conditions. Things in the background will be larger than the scale bar says, things in the foreground smaller.)

silly question
By: Danny Newman (myxomop)
2010-10-02 04:39:01 CDT (-0400)

how do you get the scale at the bottom left of each photo?

Created: 2010-10-02 03:17:33 CDT (-0400)
Last modified: 2010-10-07 00:52:14 CDT (-0400)
Viewed: 391 times, last viewed: 2016-11-01 14:33:52 CDT (-0400)
Show Log