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

Last change on this file since 7828 was 6127, checked in by bastiK, 12 years ago

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

File size: 2.0 KB
RevLine 
[4231]1/*
[6127]2 * Copyright 2002-2012 Drew Noakes
[4231]3 *
[6127]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
[4231]7 *
[6127]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/
[4231]20 */
21package com.drew.imaging;
22
23/**
24 * Contains helper methods that perform photographic conversions.
[6127]25 *
26 * @author Drew Noakes http://drewnoakes.com
[4231]27 */
[6127]28public final class PhotographicConversions
[4231]29{
30 public final static double ROOT_TWO = Math.sqrt(2);
31
[6127]32 private PhotographicConversions() throws Exception
33 {
34 throw new Exception("Not intended for instantiation.");
35 }
[4231]36
37 /**
38 * Converts an aperture value to its corresponding F-stop number.
[6127]39 *
[4231]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 {
[6127]45 return Math.pow(ROOT_TWO, aperture);
[4231]46
[6127]47 // NOTE jhead uses a different calculation as far as i can tell... this confuses me...
[4231]48 // fStop = (float)Math.exp(aperture * Math.log(2) * 0.5));
49 }
50
51 /**
52 * Converts a shutter speed to an exposure time.
[6127]53 *
[4231]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 {
[6127]59 return (float) (1 / Math.exp(shutterSpeed * Math.log(2)));
[4231]60 }
61}
Note: See TracBrowser for help on using the repository browser.