r10471: add tests, improve fov and magnification function
[cl-photo.git] / dof.lisp
index 5dfc5dd06e0dac523d29400f0bc58dd9f2152444..ee9250a745c0d613716cdc405e798f8a8e191019 100644 (file)
--- a/dof.lisp
+++ b/dof.lisp
@@ -70,6 +70,7 @@ Default resolving power is 5 lpm at 25cm."
 
 (defun maximum-sharpness-aperture (format &optional (wavelength 0.0005))
   (multiple-value-bind (coc-w coc-h lpm-w lpm-h) (coc-pixels-format format)
+    (declare (ignore coc-w coc-h))
     (/ 1. (* 1.22 wavelength (/ (min lpm-w lpm-h) 0.46)))))
 
 (defun dof-mm (focal-length f-stop distance coc &key (pupil-factor 1))
@@ -128,3 +129,9 @@ Output: NEAR-POINT, FAR-POINT, TOTAL-DOF, MAGNIFICATION, BLUR-SIZE-OF-INFINITY-P
 
 (defun effective-aperture (focal-length distance aperture)
   (* aperture (bellows-factor focal-length distance)))
+
+(defun mtf-scanner (freq dscan-freq &optional (order 3))
+  (abs (expt (kmrcl:sinc (* pi (/ freq dscan-freq))) order)))
+
+(defun freq-mtf-scanner (dscan-freq mtf &optional (order 3))
+  (* dscan-freq (/ (asin (* x (exp  (/ (log mtf) order)))) pi)))