source: josm/trunk/src/com/drew/imaging/PhotographicConversions.java@ 7129

Last change on this file since 7129 was 6127, checked in by bastiK, 11 years ago

applied #8895 - Upgrade metadata-extractor to v. 2.6.4 (patch by ebourg)

File size: 2.0 KB
Line 
1/*
2 * Copyright 2002-2012 Drew Noakes
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 * More information about this project is available at:
17 *
18 * http://drewnoakes.com/code/exif/
19 * http://code.google.com/p/metadata-extractor/
20 */
21package com.drew.imaging;
22
23/**
24 * Contains helper methods that perform photographic conversions.
25 *
26 * @author Drew Noakes http://drewnoakes.com
27 */
28public final class PhotographicConversions
29{
30 public final static double ROOT_TWO = Math.sqrt(2);
31
32 private PhotographicConversions() throws Exception
33 {
34 throw new Exception("Not intended for instantiation.");
35 }
36
37 /**
38 * Converts an aperture value to its corresponding F-stop number.
39 *
40 * @param aperture the aperture value to convert
41 * @return the F-stop number of the specified aperture
42 */
43 public static double apertureToFStop(double aperture)
44 {
45 return Math.pow(ROOT_TWO, aperture);
46
47 // NOTE jhead uses a different calculation as far as i can tell... this confuses me...
48 // fStop = (float)Math.exp(aperture * Math.log(2) * 0.5));
49 }
50
51 /**
52 * Converts a shutter speed to an exposure time.
53 *
54 * @param shutterSpeed the shutter speed to convert
55 * @return the exposure time of the specified shutter speed
56 */
57 public static double shutterSpeedToExposureTime(double shutterSpeed)
58 {
59 return (float) (1 / Math.exp(shutterSpeed * Math.log(2)));
60 }
61}
Note: See TracBrowser for help on using the repository browser.