(values coc print-magnification)))
(defun coc-pixels (imager pixels)
- "Returns circle of confusion based on pixel size."
+ "Returns lpm and circle of confusion based on pixel size."
(when (and (consp imager) (consp pixels))
- (values (float (* 2 (/ (car imager) (car pixels))))
- (float (* 2 (/ (cdr imager) (cdr pixels)))))))
+ (let ((coc-w (float (* 2 (/ (car imager) (car pixels)))))
+ (coc-h (float (* 2 (/ (cdr imager) (cdr pixels))))))
+ (values coc-w coc-h (/ 1. coc-w) (/ 1. coc-h)))))
(defun coc-pixels-format (format)
"Returns circle of confusion based on pixel size."
(coc-pixels (imager-dimensions format) (pixel-dimensions format)))
-(defun coc-airy (f-stop)
+(defun coc-airy (f-stop &optional (wavelength 0.000512))
"Return the circle of confusion based on the airy disk."
- (let ((airy (/ f-stop 1500)))
- (float (* 2 airy))))
+ (float (/ 1 (rayleigh-limit f-stop wavelength))))
+
+(defun rayleigh-limit (f-stop &optional (wavelength 0.0005))
+ "Returns the rayleigh limit in line pairs per mm (MTF 9%) as well as the MTF50"
+ (let ((rayleigh (float (/ 1 1.22 f-stop wavelength))))
+ (values rayleigh (* 0.46 rayleigh))))
+
+(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))
"Returns depth of field based on focal-length, f-stop, distance, and coc.
Six values are returned:
-near dof, far dof, total dof, near point, far point, magnification,
-blur size at infinity (mm).
+near point, far point, total dof, magnification, blur size at infinity (mm).
Circle of confusion can either be a number or keyword designating format."
(let* ((aperture (/ focal-length f-stop))
(numerator-1 (* (- pupil-factor 1) (- distance focal-length)
(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)))