Camera Estimator (metadata)#
Helper Functions
|
Factor to scale the exif resolution unit to millimeter which is used for Focal length in EXIF. |
|
Get Sensor with in mm using the image width in pixel and the tags ResolutionUnit and FocalPlaneXResolution. |
|
|
|
Main API Functions
|
Estimate the standard camera parameters. |
|
Estimate camera intrinsics (IOR) from metadata tags. |
- weitsicht.metadata.camera_estimator_metadata.get_unit_factor(resolution_unit) float | None[source]#
Factor to scale the exif resolution unit to millimeter which is used for Focal length in EXIF. Tag 0xa20e - FocalPlaneXResolution Tag 0xa210 - FocalPlaneResolutionUnit https://www.sno.phy.queensu.ca/~phil/exiftool/TagNames/EXIF.html We assume square Pixels, so we only will do it for the image width side
- Parameters:
resolution_unit – the resolution unit value given in the EXIF
- Returns:
Unit factor or None
- Return type:
float | None
- weitsicht.metadata.camera_estimator_metadata.compute_sensor_width_in_mm(image_width: int, tags: MetaTagIORBase) float | None[source]#
Get Sensor with in mm using the image width in pixel and the tags ResolutionUnit and FocalPlaneXResolution.
- Parameters:
image_width (int) – Width of image in Pixels
tags (MetaTagIORBase) – resolved metadata values
- Returns:
Sensor width in mm or None if not possible
- Return type:
float | None
- weitsicht.metadata.camera_estimator_metadata.compute_focal_length_from_35mm(focal_35mm: float, image_width: int | float, image_height: int | float) float | None[source]#
- Parameters:
focal_35mm (float)
image_width (int | float)
image_height (int | float)
- Return type:
float | None
- weitsicht.metadata.camera_estimator_metadata.compute_from_sensor_width(focal_mm: float, sensor_width: float, image_width: int) float[source]#
- Parameters:
focal_mm (float)
sensor_width (float)
image_width (int)
- Return type:
float
- weitsicht.metadata.camera_estimator_metadata.estimate_camera(tags: MetaTagIORBase) tuple[int, int, float, float, float][source]#
Estimate the standard camera parameters. Even though I am not sure if 35mm equivalent is always calculated correctly we will use that as first source, because for resampled images there could be that original exif-tags are left (e.g. PlaneResolution for example) which would be wrong for the resampled image to have correct focal length in pixel. Currently, 4 possible ways are implemented (1) Using 35mm equivalent (2) Using focal length and Resolution unit (3) Using focal length and Sensor Database; this works only if camera type is present in database More advanced calibration tags in XMP like that one from Pix4D will be treated separately The principal point is for that base estimation the center of the image
- Parameters:
meta_data – Metadata dict following exif-tools tags
tags (MetaTagIORBase)
- Raises:
ValueError – If standard Tags can not be used or if dimensions are not given
- Returns:
tuple(width, height, focal length in pixel, c_x(principal point), c_y(principal point))
- Return type:
tuple[int, int, float, float, float]
- weitsicht.metadata.camera_estimator_metadata.ior_from_meta(tags_ior: MetaTagIORBase, tags_ior_extended: MetaTagIORExtended) IORFromMetaResultSuccess | ResultFailure[MetadataIssue][source]#
Estimate camera intrinsics (IOR) from metadata tags.
- Parameters:
tags_ior (MetaTagIORBase) – Standard intrinsic-related tags.
tags_ior_extended (MetaTagIORExtended) – Optional extended calibration tags.
- Returns:
Successful IOR result or a failure result.
- Return type: