Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, img, cfg, sta=None, scale_val=1.625, CR=3):
# input variables
self._img = img
self.cfg = cfg
self.sta = sta if sta is not None else PlenopticamStatus()
self._scale_val = scale_val
self._CR = CR
# internal variables
self._scale_space = []
self._top_img = None
# output variables
self._M = None
def __init__(self, img, cfg, sta=None, M=None):
# input variables
self._img = img
self.cfg = cfg if cfg is not None else PlenopticamConfig()
self.sta = sta if sta is not None else PlenopticamStatus()
self._M = M if M is not None else self.cfg.params[self.cfg.ptc_leng]
# private variables
self._peak_img = self._img.copy()
self._centroids = []
def __init__(self, wht_img, cfg=None, sta=None):
# input variables
self._wht_img = wht_img
self.cfg = cfg if cfg is not None else PlenopticamConfig()
self.sta = sta if sta is not None else PlenopticamStatus()
# private
self._M = None
def __init__(self, *args, **kwargs):
super(PlenopticamError, self).__init__(*args)
self.cfg = kwargs['cfg'] if 'cfg' in kwargs else None
self.sta = kwargs['sta'] if 'sta' in kwargs else PlenopticamStatus()
self.args = args
try:
self.write_log()
except PermissionError as e:
self.sta.status_msg(msg=e, opt=True)
raise e
def __init__(self, centroids, cfg, sta=None, bbox=None):
# input variables
self._centroids = np.asarray(centroids) # list of unsorted maxima
self.cfg = cfg # config file
self.sta = sta if sta is not None else PlenopticamStatus()
self._bbox = bbox if bbox is not None and len(bbox) == 2 else None
# internal variables
self._lens_x_max = None # maximum number of "complete" micro image centers in a row
self._lens_y_max = None # maximum number of "complete" micro image centers in a column
self._upper_l = None
self._lower_r = None
# output variables
self._mic_list = [] # list of micro image centers with indices assigned
self._pattern = None # pattern typ of micro lens array
self._pitch = None # average pitch in horizontal and vertical direction
def load_json(fp=None, sta=None):
sta = sta if sta is not None else PlenopticamStatus()
# file name and file path handling
if fp is not None and splitext(fp)[-1] != '.json':
fn = splitext(basename(fp))[0]+'.json'
fp = join(splitext(fp)[0], fn)
# load calibration data from json file
if exists(fp):
try:
with open(fp, 'r') as f:
json_dict = json.load(f)
except json.decoder.JSONDecodeError:
remove(fp)
sta.status_msg('Calibration JSON File may be corrupted. Attempt to delete file %s' % fp, opt=True)
raise PlenopticamError('Calibration JSON File may be corrupted. Attempt to delete file %s' % fp)
else:
This class takes a list of integer coordinates as centroids and an intensity map as inputs and re-computes
:param img: image used as basis for coordinate refinement calculation
:param centroids: iterable (list or np.ndarray) with coordinates of integer type
:param cfg: PlenoptiCam configuration object
:param sta: PlenoptiCam status object
:param M: micro image size
:param method: 'area' or 'peak'
"""
# input variables
self._img = img
self._centroids = centroids #np.round(centroids).astype('uint64')
self.cfg = cfg if cfg is not None else PlenopticamConfig()
self.sta = sta if sta is not None else PlenopticamStatus()
self._M = M
self._method = method if method is not None else 'area'
# internal variables
self._t = self._s = 0
# output variables
self._centroids_refined = []
def __init__(self):
# inheritance
tk.Tk.__init__(self)
# window title
self.wm_title("PlenoptiCam-v"+__version__)
# icon handling
self.icon_handling()
# initialize parameters
self.sta = PlenopticamStatus()
# instantiate controller
self.ctrl_wid = CtrlWidget(self)
self.ctrl_wid.pack(fill='both', expand=True, side='top', padx=PX, pady=PY)
# instantiate view
self.pbar_wid = PbarWidget(self)
self.pbar_wid.pack(fill='both', expand=True, side='bottom', padx=PX, pady=PY)