Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
self.root = tk.Tk()
self.cfg = PlenopticamConfig()
self.sta = PlenopticamStatus()
self.root.cfg = self.cfg
self.root.sta = self.sta
self.set_file_path()
self.pump_events()
def setUp(self):
# set config for unit test purposes
self.sta = PlenopticamStatus()
self.cfg = PlenopticamConfig()
self.cfg.reset_values()
self.cfg.params[self.cfg.opt_dbug] = True
self.cfg.params[self.cfg.opt_prnt] = True
def __init__(self, *args, **kwargs):
self.cfg = kwargs['cfg'] if 'cfg' in kwargs else PlenopticamConfig()
self.sta = kwargs['sta'] if 'sta' in kwargs else PlenopticamStatus()
self._bay_img = kwargs['bay_img'] if 'bay_img' in kwargs else np.array([])
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 = []
"""
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 = []
fig.text(0.5, 0.2, 'Horizontal dimension [px]', ha='center', va='center', fontsize=14)
fig.text(0.06, 0.5, 'Vertical dimension [px]', ha='center', va='center', rotation='vertical', fontsize=14)
#import tikzplotlib
#tikzplotlib.save('input+mics' + fn + '.tex')
plt.savefig('input+mics'+fn+'.pdf', bbox_inches='tight', format='pdf')
plt.show()
return True
if __name__ == "__main__":
# create config object
cfg = PlenopticamConfig()
#cfg.default_values()
#cfg.reset_values()
cfg.params[cfg.cal_path] = r"/Users/Admin/Pictures/Plenoptic/CalibFolder/caldata-B5144000580.tar"
cfg.params[cfg.lfp_path] = r"/Users/Admin/Pictures/Plenoptic/INRIA_SIROCCO/Building.LFR"
#cfg.params[cfg.cal_path] = r"../../../../test/data/caldata-B5144402350.tar"
#cfg.params[cfg.lfp_path] = r"../../../../test/data/gradient_rose_far.lfr"
cfg.lfpimg['bay'] = "GRBG"
cfg.params[cfg.opt_cali] = True
cfg.params[cfg.opt_rota] = True
cfg.params[cfg.opt_dbug] = False
cfg.params[cfg.cal_meth] = 'grid-fit'
cal_opt = False
if cal_opt:
def __init__(self, cfg=None, sta=None):
# input variables
self.cfg = cfg if sta is not None else PlenopticamConfig()
self.sta = sta if sta is not None else PlenopticamStatus()
# internal variables
self._lfp_json = {}
self._georef = None
self._lensref = None
self._serial = None
self._cam_model = ''
self._cal_fn = None
self._raw_data = None
self._file_found = None
self._opt_prnt = True if sta is not None else self.cfg.params[self.cfg.opt_prnt]
self._path = self.cfg.params[self.cfg.cal_path]
# output variables
self._wht_bay = None
def __init__(self, bay_img=None, wht_img=None, cfg=None, sta=None):
# input variables
self.cfg = cfg if cfg is not None else PlenopticamConfig()
self.sta = sta if sta is not None else misc.PlenopticamStatus()
self._bay_img = bay_img.astype('float32') if isinstance(bay_img, np.ndarray) else None
self._wht_img = wht_img.astype('float32') if isinstance(wht_img, np.ndarray) else None
self._bit_pac = self.cfg.lfpimg['bit'] if 'bit' in self.cfg.lfpimg else 10
self._gains = self.cfg.lfpimg['awb'] if 'awb' in self.cfg.lfpimg else [1, 1, 1, 1]
self._bay_pat = self.cfg.lfpimg['bay'] if 'bay' in self.cfg.lfpimg else None
# output variables
self._rgb_img = np.array([])
def __init__(self, cfg=None, sta=None, *args, **kwargs):
super(PropagatingThread, self).__init__(*args, **kwargs)
# init
self.cfg = cfg if cfg is not None else PlenopticamConfig()
self.sta = sta if sta is not None else misc.PlenopticamStatus()
self.exc = None
self.ret = None
def __init__(self, img, centroids, cfg=None, sta=None):
# input variables
self._img = rgb2gry(img.copy())[..., 0] if len(img.shape) == 3 else img.copy()
self._img = Normalizer(self._img).uint8_norm()
self._centroids = np.asarray(centroids)
self.cfg = cfg if cfg is not None else PlenopticamConfig()
self.sta = sta if sta is not None else PlenopticamStatus()