Archive for the ‘English’ Category

Which focal length do you use most?

Sunday, September 13th, 2009

I was wondering, which focal length I use most. I’m asking this question because I’m considering adding a more compact camera to my equipment, which I can carry with me all the time. One aspect is size, another is image quality (which should be somehow sufficient) and another one is the lens. Assuming I’d take the Panasonic Lumix DMC-GF1, it would be small enough only with the 20mm f/1.7 pencake lens. This lens is 40mm in terms of 35mm film equivalent. A new camera with only one focal length is a bit risky investment. So the 40mm should more or less fit my photography habits. A short analysis of my photos brought up these statistics:

Focal Length Chart

The diagram shows statistics of all my photos taken with my Nikon D70s. As I’m using zoom lenses and fixed lenses, I clustered the photos by focal length and used the “classic” focal lengths, all transformed in 35 mm equivalent focal lengths, as cluster criteria: 24mm, 28mm, 35mm, 50mm, 85mm, 105mm, 140mm, 200mm (and more).

To my surprise, it shows most photos have been taken at around 85mm, followed by 24mm and 50mm.

Gathering metatdata from photos

Some may wonder how these statistics got produced. In fact, it was a very simple programming exercise. Thanks to Fabrizio Giudici’s jrawio Java library, I was able to implement a simple Java program that extracts the metadata from my NEF (Nikon RAW Format) image files. The program is quick and dirty:

public class RawStatMain {
    public static void main(final String[] args) throws IOException {
        final PrintWriter out = new PrintWriter(new File(args[1]));
        new DirectoryWalker() {
            protected void handleFile(File file, int depth, Collection results) throws IOException {
                if (file.getName().toUpperCase().endsWith(".NEF")) {
                    ImageReader reader = (ImageReader) ImageIO.getImageReaders(file).next();
                    reader.setInput(ImageIO.createImageInputStream(file));
                    IIOMetadata metadata = reader.getImageMetadata(0);
                    NEFMetadata nefMetadata = (NEFMetadata) metadata;
                    IFD exifIFD = nefMetadata.getExifIFD();
                    TagRational focalLength = exifIFD.getFocalLength();
                    out.println(focalLength.doubleValue());
                }
            }

            public void start() throws IOException {
                super.walk(new File(args[0]), new ArrayList());
            }
        }.start();
        out.flush();
        out.close();
    }
}

Besides the jrawio lib I also used Apache Jakarta commons-io for iterating through the directories. The program simply writes the focal lengths to a file, line by line. Afterwards I imported the file in Open Office Calc for further analysis.

Comparing camera sizes [Update]

Saturday, September 12th, 2009

It might be the wrong impression, but it seems that a new wave of semi-compact cameras hits the market, targeting enthusiastic amateur photographers. These cameras are relatively small in size, but focus on high image quality. One of the first camera was the Panasonic Lumix DMC-LX3, which I did not like too much. In the following chart I’ll compare the sizes of four types of cameras:

  • Point and shoot with relatively small sensor size (1/1.7"): The Canon PowerShot S90, Canon PowerShot G11 and Panasonic Lumix DMC-LX3.
  • Compact cameras with fixed lens but larger (like APS-C size) sensor: The Sigma DP2 and Leica X1.
  • Compact cameras with full-frame or ยต4:3 sized sensor and interchangeable lenses: The Panasonic DMC-GF1 and Leica M9.
  • DSLRs (full-frame and APS-C size): Nikon D3000 (the smallest Nikon DSLR), Nikon D90, Nikon D300s (the latest, most professional crop-sensor DSLR by Nikon), Nikon D70s (my current camera) and Nikon D700 (full-frame).

Camera Size Comparison Chart

Click on the image for full-sized version.

Please note: the chart shows the outer bounds of the camera; of course, cameras are not cubic blocks, but have an non-rectangular shape. That can make a huge difference in the “percieved size” of a camera. Additionally, for all cameras with interchangeable lenses (Nikon DSLRs, Leica M9 and Panasonic Lumix DMC-GF1) I show body sizes only. Lenses will increase the size significantly.

[Update] I added sensor sizes to the chart. You can view and download the PDF.

Trouble with Java for Mac OS X 10.5 Update 4? [Update]

Tuesday, June 16th, 2009

The installation of the new Java for Mac OS X 10.5 Update 4 failed on my old PowerBook. My first thoughts were, that it had something to do with the old PPC architecture. But the release notes still mention PPC compatibility. Repairing disk permissions didn’t solve the problem either.

One possible solution to fix the installation problems reported on Twitter is to download the update again manually and install it then. You find the download at Apple’s support pages:

http://support.apple.com/downloads/Java_for_Mac_OS_X_10_5_Update_4

This actually solved the problem for me. And what can I say? The update actually feels better than before! On both of my machines, image rendering seems to be smoother. If you like, check out my photo gallery, which is (currently) based on a Java Applet.

Using JAXP 1.4.x with Java 5

Monday, April 13th, 2009

Java 5 includes per default JAXP 1.3. However, sometimes it is required to upgrade to JAXP 1.4. This can be done with putting the JAXP 1.4 jars into endorsed libs. To achieve this, you have various options.

  1. As I did not want to switch JAXP for all my projects, I created a directory called endorsed in my project.
  2. Next, I copied the jar files jaxp-api-1.4.2.jar and jaxp-ri-1.4.2.jar into this directory.
  3. The Java VM now needs to be started with the VM parameter -Djava.endorsed.dirs=path_to_project/endorsed

Type conversion collection

Monday, March 16th, 2009

How do you convert a collection to a collection containing another type? Is that possible with standard Java? For example, you want to convert from Collection<String> to Collection<Integer>. Is that possible?

Now look at this piece of test code, this is how it should work:

    @Test
    public void testTransformedCollection() {
        List<String> strings = Arrays.asList("1", "2", "3");
        Collection<Integer> integers = new ConvertCollection<String, Integer>(strings) {
            @Override
            protected Integer convert(String s) {
                return Integer.valueOf(s);
            }
        };
        assertEquals(3, integers.size());
        Iterator<Integer> it = integers.iterator();
        int[] ints = {1, 2, 3};
        for (int i = 0; i < ints.length; i++) {
            assertTrue(ints[i] == it.next());
        }
    }

But does a ConvertCollection exist in any of the frameworks? How would it look like (assuming it would be immutable and only the most important methods are implemented?