def raw_lfr2xraw(self, lfp_in, calibration_in=None, dir_out=None, threads=None, i=0): """TNT process: raw LFR to xraw LFR :param lfp_in: `str`, source LFP file :param calibration_in: `str`, calibration directory :param dir_out: `str`, directory out :param threads: `int`, number of processing threads to use :param i: `int`, iteration during multi file-out process """ calibration_in = self._set_calibration_in(lfp_in, calibration_in) basedir, name, ext = self._split_path(lfp_in) dir_out = self._check_dir(dir_out) if dir_out else basedir xraw_out = self.xraw_out(dir_out, name) xraw_out = utils.sanitize_path(xraw_out) self._status("xraw LFR", "raw", src=lfp_in, dest=xraw_out, i=i) tnt = Tnt(verbose=self.verbose) tnt.threads(threads) tnt.lfp_in(lfp_in) tnt.lfp_out(xraw_out) tnt.lfr2xraw() tnt.calibration_in(calibration_in) self._execute(tnt)
def raw_eslf_out(self, lfp_in, calibration_in=None, dir_out=None, imagerep=None, threads=None, i=0): """TNT process: raw LFR to lightfield image out :param lfp_in: `str`, source LFP file :param calibration_in: `str`, calibration directory :param dir_out: `str`, directory out :param imagerep: `str`, image representation for processed LFP :param threads: `int`, number of processing threads to use :param i: `int`, iteration during multi file-out process """ calibration_in = self._set_calibration_in(lfp_in, calibration_in) imagerep = imagerep or self._db['imagerep_raw_eslf_out'] basedir, name, ext = self._split_path(lfp_in) dir_out = self._check_dir(dir_out) if dir_out else basedir eslf_out = self.eslf_out(dir_out, name, imagerep) eslf_out = utils.sanitize_path(eslf_out) slf = "standardized lightfield image" self._status(slf, "raw", src=lfp_in, dest=eslf_out, i=i) tnt = Tnt(verbose=self.verbose) tnt.threads(threads) tnt.lfp_in(lfp_in) tnt.eslf_out(eslf_out) tnt.calibration_in(calibration_in) self._execute(tnt)
def raw_depth_out(self, lfp_in, calibration_in=None, depth_in=None, depthrep=None, dir_out=None, imagerep=None, orientation=None, threads=None, i=0): """TNT process: raw LFR to warp depth out :param lfp_in: `str`, source LFP file :param calibration_in: `str`, calibration directory :param depth_in: `str`, depth map input file :param depthrep: `str`, depth map representation :param dir_out: `str`, directory out :param imagerep: `str`, image representation for processed LFP :param orientation: `int`, image orientation :param threads: `int`, number of processing threads to use :param i: `int`, iteration during multi file-out process """ calibration_in = self._set_calibration_in(lfp_in, calibration_in) depthrep = depthrep or self._db['depthrep_raw_depth_out'] imagerep = imagerep or self._db['imagerep_raw_depth_out'] basedir, name, ext = self._split_path(lfp_in) dir_out = self._check_dir(dir_out) if dir_out else basedir depth_out = self.depth_out(dir_out, name, depthrep) image_out = self.image_out(dir_out, name, imagerep) depth_out = utils.sanitize_path(depth_out) image_out = utils.sanitize_path(image_out) jsn_out = self.jsn_out(image_out) dest = depth_out, image_out, jsn_out self._status("depth map", "raw", src=lfp_in, dest=dest, i=i) tnt = Tnt(verbose=self.verbose) tnt.threads(threads) tnt.lfp_in(lfp_in) tnt.depth_out(depth_out) tnt.image_out(image_out) tnt.orientation(orientation) tnt.calibration_in(calibration_in) tnt.depth_in(depth_in) self._execute(tnt)
def raw_unpack(self, lfp_in, calibration_in=None, depth_in=None, depthrep=None, dir_out=None, height=None, imagerep=None, orientation=None, perspective_u=None, perspective_v=None, recipe_in=None, threads=None, width=None, i=0): """TNT process: raw LFR to image out :param lfp_in: `str`, source LFP file :param calibration_in: `str`, calibration directory :param depth_in: `str`, depth map input file :param depthrep: `str`, depth map representation :param dir_out: `str`, directory out :param height: `int`, resolution height (in pixels) :param imagerep: `str`, image representation for processed LFP :param orientation: `int`, image orientation :param perspective_u: `float`, perspective u coordinate :param perspective_v: `float`, perspective v coordinate :param recipe_in: `str`, input recipe file :param threads: `int`, number of processing threads to use :param width: `int`, resolution width (in pixels) :param i: `int`, iteration during multi file-out process """ calibration_in = self._set_calibration_in(lfp_in, calibration_in) depthrep = depthrep or self._db['depthrep_raw_unpack'] imagerep = imagerep or self._db['imagerep_raw_unpack'] height, width = self._set_height_width(lfp_in, height, width) basedir, name, ext = self._split_path(lfp_in) recipe_in = self.set_recipe_in(recipe_in, i) parent_dir = self._check_dir(dir_out) if dir_out else basedir dir_out = os.path.join(parent_dir, name) dir_out = self._check_dir(dir_out, sane=True) lfp_out = self.lfp_out_unpacked(dir_out, name) self._status("unpacked warp LFP", "raw", src=lfp_in, dest=dir_out, i=i) tnt = Tnt(verbose=self.verbose) tnt.threads(threads) tnt.lfp_in(lfp_in) tnt.dir_out(dir_out) tnt.lfp_out(lfp_out) tnt.unpack() tnt.imagerep(imagerep) tnt.depthrep(depthrep) tnt.height(height) tnt.width(width) tnt.orientation(orientation) tnt.depth_in(depth_in) tnt.recipe_in(recipe_in) tnt.calibration_in(calibration_in) tnt.perspective_u(perspective_u) tnt.perspective_v(perspective_v) self._execute(tnt) if os.path.exists(lfp_out): self.recipe_out(lfp_out, threads=threads, i=i) self.warp_depth_map_json_out(lfp_out, i=i)
def raw_image_out(self, lfp_in, image_out=None, calibration_in=None, depth_in=None, dir_out=None, focus=None, height=None, imagerep=None, orientation=None, perspective_u=None, perspective_v=None, recipe_in=None, threads=None, width=None, i=0): """TNT process: raw LFR to image out :param lfp_in: `str`, source LFP file :param calibration_in: `str`, calibration directory :param depth_in: `str`, depth map input file :param dir_out: `str`, directory out :param focus: `float`, image focus point :param height: `int`, resolution height (in pixels) :param image_out: `str`, destination image file :param imagerep: `str`, image representation for processed LFP :param orientation: `int`, image orientation :param perspective_u: `float`, perspective u coordinate :param perspective_v: `float`, perspective v coordinate :param recipe_in: `str`, input recipe file :param threads: `int`, number of processing threads to use :param width: `int`, resolution width (in pixels) :param i: `int`, iteration during multi file-out process """ calibration_in = self._set_calibration_in(lfp_in, calibration_in) imagerep = imagerep or self._db['imagerep_raw_image_out'] height, width = self._set_height_width(lfp_in, height, width) u, v = perspective_u, perspective_v recipe_in = self.set_recipe_in(recipe_in, i) if not image_out: basedir, name, ext = self._split_path(lfp_in) dir_out = self._check_dir(dir_out) if dir_out else basedir image_out = self.image_out(dir_out, name, imagerep) image_out = self._image_id(image_out, focus, u, v) image_out = utils.sanitize_path(image_out) self._status("image", "raw", src=lfp_in, dest=image_out, i=i) tnt = Tnt(verbose=self.verbose) tnt.threads(threads) tnt.lfp_in(lfp_in) tnt.image_out(image_out) tnt.calibration_in(calibration_in) tnt.imagerep(imagerep) tnt.height(height) tnt.width(width) tnt.orientation(orientation) tnt.depth_in(depth_in) tnt.recipe_in(recipe_in) tnt.focus(focus) tnt.perspective_u(u) tnt.perspective_v(v) self._execute(tnt)