Modifier class¶
- class lensfunpy.Modifier(Lens lens, float crop, int width, int height)¶
- Parameters:
lensfunpy.Lens –
crop (float) – crop factor of …?
width (int) – width of image in pixels
height (int) – height of image in pixels
- apply_geometry_distortion(self, float xu=0, float yu=0, int width=-1, int height=-1)¶
- Returns:
coordinates for geometry distortion correction, or None if calibration data missing
- Return type:
ndarray of shape (height, width, 2) or None
- apply_subpixel_distortion(self, float xu=0, float yu=0, int width=-1, int height=-1)¶
- Returns:
per-channel coordinates for subpixel distortion correction, or None if calibration data missing
- Return type:
ndarray of shape (height, width, 3, 2) or None
- apply_subpixel_geometry_distortion(self, float xu=0, float yu=0, int width=-1, int height=-1)¶
- Returns:
per-channel coordinates for combined distortion and subpixel distortion correction, or None if calibration data missing
- Return type:
ndarray of shape (height, width, 3, 2) or None
- initialize(self, float focal, float aperture, float distance=1000.0, float scale=0.0, targeom=LensType.RECTILINEAR, pixel_format=np.uint8, int flags=ModifyFlags.ALL, bool reverse=0)¶
- Parameters:
focal (float) – The focal length in mm at which the image was taken.
aperture (float) – The aperture (f-number) at which the image was taken.
distance (float) – The approximative focus distance in meters (distance > 0).
scale (float) – An additional scale factor to be applied onto the image (1.0 - no scaling; 0.0 - automatic scaling).
targeom (lensfunpy.LensType) – Target geometry. If LF_MODIFY_GEOMETRY is set in flags and targeom is different from lens.type, a geometry conversion will be applied on the image.
pixel_format – Pixel format of the image.
flags (int) – A set of flags (see
lensfunpy.ModifyFlags
) telling which distortions you want corrected. A value of ModifyFlags.ALL orders correction of everything possible (will enable all correction models present in lens description).reverse (bool) – If this parameter is true, a reverse transform will be prepared. That is, you take an undistorted image as input and convert it so that it will look as if it would be a shot made with lens.
- aperture¶
The aperture used when initialising the modifier.
- Return type:
float
- apply_color_modification¶
- Parameters:
img (ndarray) – Image (h,w,3) for which to apply the vignetting correction, in place.
- Returns:
true if vignetting correction was applied, otherwise false
- Return type:
bool
- crop¶
The crop factor used when creating the modifier.
- Return type:
float
- distance¶
The subject distance used when initialising the modifier.
- Return type:
float
- focal_length¶
The focal lenght used when initialising the modifier.
- Return type:
float
- height¶
The image height used when creating the modifier.
- Return type:
int
- lens¶
The
lensfunpy.Lens
used when creating the modifier.
- scale¶
The scale used when initialising the modifier.
- Return type:
float
- width¶
The image width used when creating the modifier.
- Return type:
int