pypocquant.lib.utils
Module Contents
Functions
|
Save the list of requested quality control images. |
|
Returns project root folder. |
|
Returns the value of the environment variable DATA_FOLDER or, |
|
Converts a image in raw format (.’nef’) to the specified open format. Default is ‘.tif’. |
|
Returns the date in iso-date format for the image at the given path. |
|
Returns the Exif metadata for the image at the given path. In particular EXIF ExposureTime, EXIF FNumber, |
|
Returns the image orientation for the image at the given path from the EXIF metadata. |
|
Returns true if a certain program is on the environment variable PATH. |
Sets the path to the executable of tesseract. |
|
|
Removes duplicates entry from a pandas data frame based on the column NAME. |
-
pypocquant.lib.utils.create_quality_control_images(results_folder_path: str, basename: str, map_of_images: dict, extension: str = '.png', quality: int = 100) Save the list of requested quality control images.
- Parameters:
results_folder_path (str) – Full path to the folder where to save the quality control images.
basename (str) – Common base name for all quality control images.
map_of_images (dict) – Dictionary of keys to be appended to the base name with the corresponding image as value.
extension (str) – File extension (format). Optional, default is .png.
quality (int) – Image compression quality. Optional, default is 100. This is only considered if format is “.jpg”.
-
pypocquant.lib.utils.get_project_root() → Path Returns project root folder.
- Returns:
project_root
- Return type:
Path
-
pypocquant.lib.utils.get_data_folder() → Path Returns the value of the environment variable DATA_FOLDER or, if not found, the value if get_project_root().
- Returns:
data_folder
- Return type:
Path
-
pypocquant.lib.utils.image_format_converter(directory, filename, output_dir=None, image_format='tif') - Converts a image in raw format (.’nef’) to the specified open format. Default is ‘.tif’.
- Parameters:
directory – Image directory
filename (str) – Filename of the image to be converted
output_dir – Output directory to write the converted image to.
image_format (str) – Format of the image such as i.e. tif
-
pypocquant.lib.utils.get_iso_date_from_image(image_path) Returns the date in iso-date format for the image at the given path.
- Parameters:
image_path (str) – Path to an image.
- Returns:
iso_date
- Returns:
iso_time
-
pypocquant.lib.utils.get_exif_details(image_path) Returns the Exif metadata for the image at the given path. In particular EXIF ExposureTime, EXIF FNumber, EXIF FocalLengthIn35mmFilm, EXIF ISOSpeedRatings.
- Parameters:
image_path (str) – Path to an image.
- Returns:
exp_time
- Returns:
f_number
- Returns:
focal_length_35_mm
- Returns:
iso_speed
-
pypocquant.lib.utils.get_orientation_from_image(image_path) Returns the image orientation for the image at the given path from the EXIF metadata.
- Parameters:
image_path (str) – Path to an image.
- Returns:
orientation
-
pypocquant.lib.utils.is_on_path(prog) Returns true if a certain program is on the environment variable PATH.
- param prog:
Name of a program
- type prog:
str
- Return type:
boolean
-
pypocquant.lib.utils.set_tesseract_exe() Sets the path to the executable of tesseract.
-
pypocquant.lib.utils.remove_filename_duplicates(data_frame) Removes duplicates entry from a pandas data frame based on the column NAME. :param data_frame:
Pandas data frame
- Returns:
data_frame
- Return type:
pd.DataFrame