コード例 #1
0
    def main(self):

        self.cfg.load_cal_data()

        # micro image crop
        lfp_obj = LfpCropper(self._lfp_img_align, cfg=self.cfg, sta=self.sta)
        lfp_obj.main()
        self._lfp_img_align = lfp_obj.lfp_img_align
        del lfp_obj

        # viewpoint images
        if self.cfg.params[self.cfg.opt_view]:
            lfp_obj = LfpRearranger(self._lfp_img_align, cfg=self.cfg, sta=self.sta)
            lfp_obj.main()
            self._vp_img_arr = lfp_obj.vp_img_arr
            del lfp_obj

        # refocused image stack
        if self.cfg.params[self.cfg.opt_refo]:
            lfp_obj = LfpRefocuser(vp_img_arr=self._vp_img_arr, cfg=self.cfg, sta=self.sta)
            lfp_obj.main()
            self._refo_stack = lfp_obj.refo_stack
            del lfp_obj

        # scheimpflug focus
        if self.cfg.params[self.cfg.opt_pflu] != 'off':
            lfp_obj = LfpScheimpflug(refo_stack=self._refo_stack, cfg=self.cfg, sta=self.sta)
            lfp_obj.main()
            del lfp_obj

        # print status
        self.sta.status_msg('Export finished', opt=True)
        self.sta.progress(100, opt=True)

        return True
コード例 #2
0
ファイル: top_level.py プロジェクト: atomicguy/plenopticam
    def main(self):

        # load previously calculated calibration and aligned data
        self.cfg.load_cal_data()
        if self._lfp_img_align is None:
            self.load_pickle_file()
            self.load_lfp_metadata()

        # micro image crop
        lfp_obj = LfpCropper(lfp_img_align=self._lfp_img_align, cfg=self.cfg, sta=self.sta)
        lfp_obj.main()
        self._lfp_img_align = lfp_obj.lfp_img_align
        del lfp_obj

        # rearrange light-field to sub-aperture images
        if self.cfg.params[self.cfg.opt_view]:
            lfp_obj = LfpRearranger(self._lfp_img_align, cfg=self.cfg, sta=self.sta)
            lfp_obj.main()
            self.vp_img_linear = lfp_obj.vp_img_arr
            del lfp_obj

        # remove outliers if option is set
        if self.cfg.params[self.cfg.opt_lier]:
            obj = LfpOutliers(vp_img_arr=self.vp_img_linear, cfg=self.cfg, sta=self.sta)
            obj.main()
            self.vp_img_linear = obj.vp_img_arr
            del obj

        # color equalization
        if self.cfg.params[self.cfg.opt_colo]:
            obj = LfpColorEqualizer(vp_img_arr=self.vp_img_linear, cfg=self.cfg, sta=self.sta)
            obj.main()
            self.vp_img_linear = obj.vp_img_arr
            del obj

        # copy light-field for refocusing process prior to contrast alignment and export
        self.vp_img_arr = self.vp_img_linear.copy() if self.vp_img_linear is not None else None

        # color management automation
        obj = LfpContrast(vp_img_arr=self.vp_img_arr, cfg=self.cfg, sta=self.sta)
        obj.main()
        self.vp_img_arr = obj.vp_img_arr
        del obj

        # reduction of hexagonal sampling artifacts
        if self.cfg.params[self.cfg.opt_arti]:
            obj = HexCorrector(vp_img_arr=self.vp_img_arr, cfg=self.cfg, sta=self.sta)
            obj.main()
            self.vp_img_arr = obj.vp_img_arr
            del obj

        # write viewpoint data to hard drive
        if self.cfg.params[self.cfg.opt_view]:
            obj = LfpExporter(vp_img_arr=self.vp_img_arr, cfg=self.cfg, sta=self.sta)
            obj.write_viewpoint_data()
            del obj

        return True
コード例 #3
0
ファイル: top_level.py プロジェクト: igxactly/plenopticam
    def main(self):

        self.cfg.load_cal_data()

        # micro image crop
        lfp_obj = LfpCropper(lfp_img_align=self._lfp_img_align, cfg=self.cfg, sta=self.sta)
        lfp_obj.main()
        self._lfp_img_align = lfp_obj.lfp_img_align
        del lfp_obj

        # viewpoint images
        if self.cfg.params[self.cfg.opt_view] and not self.sta.interrupt:
            lfp_obj = LfpRearranger(self._lfp_img_align, cfg=self.cfg, sta=self.sta)
            lfp_obj.main()
            self.vp_img_arr = lfp_obj.vp_img_arr
            del lfp_obj

        # histogram equalization
        if self.cfg.params[self.cfg.opt_cont] and not self.sta.interrupt:
            obj = HistogramEqualizer(img=self.vp_img_arr)
            self.vp_img_arr = obj.lum_eq()
            #self.vp_img_arr = obj.awb_eq()
            del obj

        # remove hot pixels if option is set
        if self.cfg.params[self.cfg.opt_hotp] and not self.sta.interrupt:
            obj = LfpHotPixels(vp_img_arr=self.vp_img_arr, cfg=self.cfg, sta=self.sta)
            obj.main()
            self.vp_img_arr = obj.vp_img_arr
            del obj

        # color equalization
        if self.cfg.params[self.cfg.opt_colo] and not self.sta.interrupt:
            obj = LfpColorEqualizer(vp_img_arr=self.vp_img_arr, cfg=self.cfg, sta=self.sta)
            obj.main()
            self.vp_img_arr = obj._vp_img_arr
            del obj

        if not self.sta.interrupt:
            obj = LfpContrast(vp_img_arr=self.vp_img_arr, cfg=self.cfg, sta=self.sta, p_lo=0.005, p_hi=0.999)
            # automatic white balance
            if self.cfg.params[self.cfg.opt_awb_]:
                obj.auto_wht_bal()
            else:
                obj.channel_bal()
            obj.p_lo = 0
            obj.p_hi = 1

            # automatic saturation
            if self.cfg.params[self.cfg.opt_sat_]:
                obj.sat_bal()

            self.vp_img_arr = obj.vp_img_arr
            del obj

        # write viewpoint data to hard drive
        if self.cfg.params[self.cfg.opt_view] and not self.sta.interrupt:
            obj = LfpExporter(vp_img_arr=self.vp_img_arr, cfg=self.cfg, sta=self.sta)
            obj.write_viewpoint_data()
            del obj

        return True
コード例 #4
0
    def main(self):

        self.cfg.load_cal_data()

        # micro image crop
        lfp_obj = LfpCropper(lfp_img_align=self._lfp_img_align,
                             cfg=self.cfg,
                             sta=self.sta)
        lfp_obj.main()
        self._lfp_img_align = lfp_obj.lfp_img_align
        del lfp_obj

        # rearrange light-field to sub-aperture images
        if self.cfg.params[self.cfg.opt_view] and not self.sta.interrupt:
            lfp_obj = LfpRearranger(self._lfp_img_align,
                                    cfg=self.cfg,
                                    sta=self.sta)
            lfp_obj.main()
            self.vp_img_arr = lfp_obj.vp_img_arr
            del lfp_obj

        # remove outliers if option is set
        if self.cfg.params[self.cfg.opt_lier] and not self.sta.interrupt:
            obj = LfpOutliers(vp_img_arr=self.vp_img_arr,
                              cfg=self.cfg,
                              sta=self.sta)
            obj.main()
            self.vp_img_arr = obj.vp_img_arr
            del obj

        # color equalization
        if self.cfg.params[self.cfg.opt_colo] and not self.sta.interrupt:
            obj = LfpColorEqualizer(vp_img_arr=self.vp_img_arr,
                                    cfg=self.cfg,
                                    sta=self.sta)
            obj.main()
            self.vp_img_arr = obj.vp_img_arr
            del obj

        # copy light-field for refocusing process prior to contrast alignment and export
        vp_img_exp = self.vp_img_arr.copy()

        # color management automation
        if not self.sta.interrupt:
            obj = LfpContrast(vp_img_arr=vp_img_exp,
                              cfg=self.cfg,
                              sta=self.sta)
            obj.main()
            vp_img_exp = obj.vp_img_arr
            del obj

        # reduction of hexagonal sampling artifacts
        if self.cfg.params[self.cfg.opt_arti] and not self.sta.interrupt:
            obj = HexCorrector(vp_img_arr=vp_img_exp,
                               cfg=self.cfg,
                               sta=self.sta)
            obj.main()
            vp_img_exp = obj.vp_img_arr
            del obj

        # write viewpoint data to hard drive
        if self.cfg.params[self.cfg.opt_view] and not self.sta.interrupt:
            obj = LfpExporter(vp_img_arr=vp_img_exp,
                              cfg=self.cfg,
                              sta=self.sta)
            obj.write_viewpoint_data()
            del obj

        return True