Package pyvision :: Package other :: Module optics
[hide private]
[frames] | no frames]

Source Code for Module pyvision.other.optics

 1  ''' 
 2  Created on Mar 22, 2013 
 3   
 4  @author: David S. Bolme 
 5  Oak Ridge National Laboratory 
 6  ''' 
 7   
8 -def diffractionLimit(distance,wavelength,aperture):
9 ''' 10 This function computes the Diffraction limit of an optical system. It 11 returns the smallest resolvable pattern at a given wavelength and 12 aperture. 13 14 @param distance: distance to the target in meters. 15 @param wavelength: the wavelength of the light in nanometers 16 @param aperture: the size of the aperture in meters. 17 @returns: the resolution limit in meters 18 ''' 19 # Convert the wavelength of the 20 wavelength = 1.0e-9*wavelength 21 22 # Compute the resolution 23 resolution = distance * 1.220*(wavelength/aperture) 24 return resolution
25
26 -def apertureComputation(distance,wavelength,resolution):
27 ''' 28 This function computes the Diffraction limit of an optical system. It 29 returns the smallest resolvable pattern at a given wavelength and 30 aperture. 31 32 @param distance: distance to the target in meters. 33 @param wavelength: the wavelength of the light in nanometers 34 @param resolution: the resolution on target in metes. 35 @returns: the aperture size in meters. 36 ''' 37 # Convert the wavelength of the 38 wavelength = 1.0e-9*wavelength 39 40 # Compute the resolution 41 aperture = (distance * 1.220* wavelength) / resolution 42 43 return aperture
44
45 -def fNumber(focal_length,aperture):
46 N=focal_length/aperture 47 return N
48
49 -def depthOfField(hyperfocal,distance):
50 ''' 51 52 ''' 53 H = hyperfocal 54 s = distance 55 Dn = (H*s)/(H+s) 56 Df = (H*s)/(H-s) 57 return Dn,Df,Df-Dn
58
59 -def hyperFocalDistance(focal_length,fnumber,circle_of_confusion,definition=2):
60 ''' 61 http://en.wikipedia.org/wiki/Hyperfocal_distance 62 63 Definition 1: The hyperfocal distance is the closest distance at which a 64 lens can be focused while keeping objects at infinity acceptably sharp. 65 When the lens is focused at this distance, all objects at distances from 66 half of the hyperfocal distance out to infinity will be acceptably sharp. 67 68 Definition 2: The hyperfocal distance is the distance beyond which all 69 objects are acceptably sharp, for a lens focused at infinity. 70 ''' 71 return (focal_length**2)/(fnumber*circle_of_confusion)
72