# Path: utils/exposure_helper.py
# def calculate_ev100_from_metadata(aperture_f: float, shutter_s: float, iso: int):
#     ev_s = np.log2((aperture_f * aperture_f) / shutter_s)
#     ev_100 = ev_s - np.log2(iso / 100)
#     return ev_100


import os
import imageio
import numpy as np
import PIL.Image
import utils.exif_helper as ehelp
from subprocess import check_output
from utils.exposure_helper import calculate_ev100_from_metadata

    ev100s = handle_exif(basedir)

    sfx = ""

    if factor is not None:
        print("Apply factor", factor)
        sfx = "_{}".format(factor)
        _minify(basedir, factors=[factor])
        factor = factor
    elif height is not None:
        factor = sh[0] / float(height)
        width = int(sh[1] / factor)
        _minify(basedir, resolutions=[[height, width]])
        sfx = "_{}x{}".format(width, height)
    elif width is not None:
        factor = sh[1] / float(width)
        height = int(sh[0] / factor)
        _minify(basedir, resolutions=[[height, width]])
        sfx = "_{}x{}".format(width, height)
    else:
        factor = 1

    imgdir = os.path.join(basedir, "images" + sfx)
    maskdir = os.path.join(basedir, "masks" + sfx)
    if not os.path.exists(imgdir):
        print(imgdir, "does not exist, returning")
        return

    if not os.path.exists(maskdir):

# Path: utils/exposure_helper.py
# def calculate_ev100_from_metadata(aperture_f: float, shutter_s: float, iso: int):
#     ev_s = np.log2((aperture_f * aperture_f) / shutter_s)
#     ev_100 = ev_s - np.log2(iso / 100)
#     return ev_100


# Path: dataflow/nerd/load_real_world.py
import os
import imageio
import numpy as np
import PIL.Image
import utils.exif_helper as ehelp
from subprocess import check_output
from utils.exposure_helper import calculate_ev100_from_metadata


    ev100s = handle_exif(basedir)

    sfx = ""

    if factor is not None:
        print("Apply factor", factor)
        sfx = "_{}".format(factor)
        _minify(basedir, factors=[factor])
        factor = factor
    elif height is not None:
        factor = sh[0] / float(height)
        width = int(sh[1] / factor)
        _minify(basedir, resolutions=[[height, width]])
        sfx = "_{}x{}".format(width, height)
    elif width is not None:
        factor = sh[1] / float(width)
        height = int(sh[0] / factor)
        _minify(basedir, resolutions=[[height, width]])
        sfx = "_{}x{}".format(width, height)
    else:
        factor = 1

    imgdir = os.path.join(basedir, "images" + sfx)
    maskdir = os.path.join(basedir, "masks" + sfx)
    if not os.path.exists(imgdir):
        print(imgdir, "does not exist, returning")
        return

    if not os.path.exists(maskdir):

        print(maskdir, "does not exist, returning")