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