1 ;;;; -*- Mode: LISP; Syntax: ANSI-Common-Lisp; Base: 10; Package: photo -*-
2 ;;;; *************************************************************************
3 ;;;; FILE IDENTIFICATION
5 ;;;; Name: cameras.lisp
6 ;;;; Purpose: Camera-specific data for cl-photo
7 ;;;; Programmer: Kevin M. Rosenberg
8 ;;;; Date Started: April 2005
10 ;;;; $Id: dof.lisp 10421 2005-04-19 21:57:00Z kevin $
12 ;;;; This file, part of cl-photo, is Copyright (c) 2005 by Kevin M. Rosenberg
14 ;;;; cl-photo users are granted the rights to distribute and use this software
15 ;;;; as governed by the terms of the GNU General Public License v2
16 ;;;; (http://www.gnu.org/licenses/gpl.html)
18 ;;;; *************************************************************************
22 (defun sensor-dimensions-megapixels (format megapixels)
23 (let* ((dim (format-dimensions format))
24 (aspect-ratio (/ (car dim) (cdr dim)))
25 (width (round (sqrt (* aspect-ratio 1000000 megapixels)))))
26 (cons width (round (/ width aspect-ratio)))))
29 (defun sensor-dimensions (sensor-spec &key (format :aps))
30 "Returns the number of pixels for a sensor.
31 CAMERA-SPEC is either a keyword designating the camera or
32 the number of megapixels of the sensor.
33 FORMAT should be defined if the CAMERA-SPEC is the number of megapixels
34 so the proper aspect ratio is used."
35 (etypecase sensor-spec
39 (:d2x (cons 4288 2848))
40 (:d100 (cons 3037 2024))
41 (:d2h (cons 2464 1632))
42 (:d70 (cons 3008 2000))
45 (:1d (cons 2464 1648))
46 (:1d2 (cons 3504 2336))
47 (:1ds (cons 4064 2704))
48 (:1ds2 (cons 4992 3328))
52 (sensor-dimensions-megapixels format sensor-spec))))
55 (defun format-dimensions (format)
56 "Returns format dimensions in mm."
58 (:aps-c (cons 22.7 15.1))
59 ((:aps :dx :24x16mm) (cons 24 16))
60 ((:35mm :36x24mm) (cons 36 24))
61 (:6x4.5cm (cons 60 45))
62 ((:6x6 :6x6cm) (cons 60 60))
63 ((:6x7 :6x7cm) (cons 60 70))
64 ((:6x9 :6x9cm) (cons 60 90))
65 ((:4x5 :4x5in) (cons (* 4 +inches->mm+) (* 5 +inches->mm+)))
66 ((:5x7 :5x7in) (cons (* 5 +inches->mm+) (* 7 +inches->mm+)))
67 ((:8x10 :8x10in) (cons (* 8 +inches->mm+) (* 10 +inches->mm+)))
68 (:11x13.75in (cons (* 11 +inches->mm+) (* 13.75 +inches->mm+)))
69 (:11x16.5in (cons (* 11 +inches->mm+) (* 16.5 +inches->mm+)))
70 (:13x19in (cons (* 13 +inches->mm+) (* 19 +inches->mm+)))
71 (:16x20in (cons (* 13 +inches->mm+) (* 19 +inches->mm+)))
72 (:16x24in (cons (* 13 +inches->mm+) (* 19 +inches->mm+)))
73 (:18x22.5in (cons (* 13 +inches->mm+) (* 19 +inches->mm+)))
74 (:18x24in (cons (* 13 +inches->mm+) (* 19 +inches->mm+)))
75 (:24x30in (cons (* 13 +inches->mm+) (* 19 +inches->mm+)))
76 (:24x36in (cons (* 13 +inches->mm+) (* 19 +inches->mm+)))