Mai 172014
 

When thinking about buying a new prime or zoom lens for your DSLR, it is good to know some statistics of the photos you have taken in the past. In this article, we will create a histogram of the focal lengths of all pictures.

The method was tested on Linux. It might work on Mac OS X and Windows (maybe using Cygwin) as well.

First, let’s create a CSV file containing information about the camera model, lens and focal length of each picture. You can add arbitrary EXIF information in this step (see man page of exiftool).

exiftool -csv -Model -Lens -FocalLength -r <directory> > lens-stat.csv

The lines in this file look like this:

<path to image file>,Canon EOS 550D,18.0 - 55.0 mm,36.0 mm

Optionally, you can filter this file for certain camera models and lenses. In this example, I wanted get all shots taken with my Canon EOS 550D and its 18-55 mm kit lens.

grep "Canon EOS 550D" lens-stat.csv | grep "18.0 - 55.0 mm" > lens-stat-filtered.csv

For the histogram, we need only the last column. The unit (mm in this case) can be ignored.

awk -F'[, ]' "{print $(NF-1)}" lens-stat-filtered.csv > focal-length-stat.dat

Depending on your shell, you might have to escape the $ by writing \$.

The option -F defines the delimiter (here: comma and space), und $(NF-1) refers to the second to last column (the unit mm is the last one).

Finally, we can create the histogram:

gnuplot -p <(echo "binwidth=1; bin(x,width)=width*floor(x/width)+binwidth/2.0; set boxwidth binwidth; plot 'focal-length-stat.dat' using (bin($1,binwidth)):(1.0) smooth freq with boxes")

Again, depending on the shell, you might have to escape the $ by writing \$.

The result:

Histogram of the focal length.

Histogram of the focal length.

As it seems, I should buy both, a telezoom and a a wide angle lens 🙂

 Veröffentlicht von am 20:24

  2 Antworten zu “Focal Length Statistics”

  1. Eine Anregung: Vielleicht ist es auĂźerdem interessant die Anzahl der Bilder ĂĽber dem Ă–ffnungwinkel aufzutragen.

  2. Am grundsätzlichen Aussehen des Histogramms wird sich damit wohl nichts ändern, aber ich werde es mal versuchen.

Auf Andreas antworten Antwort abbrechen

Du kannst diese HTML Tags und Attribute benutzen: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">

(erforderlich)

(erforderlich)