auromat.util.image module

auromat.util.image.convertExifDate(dateStr, subsecStr=None)[source]

Converts an EXIF date/time string to a datetime object.

Parameters:
  • dateStr – date of format %Y:%m:%d %H:%M:%S
  • subsecStr – float part of seconds as string, e.g. “05”
Return type:

datetime.datetime

auromat.util.image.croppedImage(im, divisible_by=16)[source]

Return image cropped to the next smaller width/height divisable by the given factor. Cropping is done on each side and will fail if the amount to crop cannot be divided by 2.

auromat.util.image.image2cv(rgb)[source]

Converts RGB image to BGR uint8 image suitable for use within OpenCV.

auromat.util.image.image2mpl(rgb)[source]

Converts image to [0,1] range suitable for matplotlib.

auromat.util.image.loadImage(imagePath)[source]

Return RGB image in native color range (e.g. [0,255] for uint8). Ignores the alpha channel.

Note that this function is not meant for reading RAW files. Use rawpy with desired postprocessing settings instead.

Parameters:imagePath
Return type:rgb array of shape (height,width,3)
auromat.util.image.readExifTime(imagePath)[source]

Reads the date/time an image was taken from its EXIF header. If available, sub second time is used as the fractional part of the seconds.

Return type:datetime
auromat.util.image.readExposureTime(imagePath)[source]

Reads the exposure time in seconds from the EXIF header of an image.

Return type:float|None
auromat.util.image.readFocalLength35mm(imagePath)[source]

Reads the focal length corresponding to 35mm film from the EXIF header of an image.

Return type:int|None
auromat.util.image.saveImage(imagePath, im, **kw)[source]
Parameters:
  • imagePath – output path
  • im – the image

Additional optional keywords for JPEG:

Parameters:
  • quality – 1 to 95
  • subsampling – ‘4:4:4’, ‘4:2:2’, or ‘4:1:1’