예제 #1
0
def paramsFactory(filename, n_img, n_pts=4):
    if filename == "ptv.par":
        return parameters.PtvParams()
    if filename == "cal_ori.par":
        return parameters.CalOriParams(n_img)
    if filename == "sequence.par":
        return parameters.SequenceParams(n_img)
    if filename == "criteria.par":
        return parameters.CriteriaParams()
    if filename == "targ_rec.par":
        return parameters.TargRecParams(n_img)
    if filename == "man_ori.par":
        return parameters.ManOriParams(n_img, n_pts)
    if filename == "detect_plate.par":
        return parameters.DetectPlateParams()
    if filename == "orient.par":
        return parameters.OrientParams()
    if filename == "track.par":
        return parameters.TrackingParams()
    if filename == "pft_version.par":
        return parameters.PftVersionParams()
    if filename == "examine.par":
        return parameters.ExamineParams()
    if filename == "dumbbell.par":
        return parameters.DumbbellParams()
    if filename == "shaking.par":
        return parameters.ShakingParams()

    return None
예제 #2
0
    def closed(self, info, is_ok):
        mainParams = info.object
        par_path = mainParams.par_path
        Handler.closed(self, info, is_ok)
        if is_ok:
            img_name = [mainParams.Name_1_Image, mainParams.Name_2_Image,\
               mainParams.Name_3_Image, mainParams.Name_4_Image]
            img_cal_name = [mainParams.Cali_1_Image, mainParams.Cali_2_Image,\
                mainParams.Cali_3_Image,mainParams.Cali_4_Image]

            gvthres = [mainParams.Gray_Tresh_1,mainParams.Gray_Tresh_2,\
                 mainParams.Gray_Tresh_3,mainParams.Gray_Tresh_4]
            base_name = [mainParams.Basename_1_Seq, mainParams.Basename_2_Seq,\
                mainParams.Basename_3_Seq, mainParams.Basename_4_Seq]
            X_lay = [mainParams.Xmin, mainParams.Xmax]
            Zmin_lay = [mainParams.Zmin1, mainParams.Zmin2]
            Zmax_lay = [mainParams.Zmax1, mainParams.Zmax2]

            #write ptv_par
            par.PtvParams(mainParams.Num_Cam, img_name, img_cal_name,\
                  mainParams.HighPass, mainParams.Accept_OnlyAllCameras,\
                  mainParams.tiff_flag, mainParams.imx, mainParams.imy,\
                  mainParams.pix_x, mainParams.pix_y, mainParams.chfield,\
                  mainParams.Refr_Air, mainParams.Refr_Glass, \
                  mainParams.Refr_Water, mainParams.Thick_Glass, path = par_path).write()
            #write calibration parameters
            par.CalOriParams(mainParams.Num_Cam,mainParams.fixp_name,\
                   mainParams.img_cal_name,mainParams.img_ori,mainParams.tiff_flag,\
                   mainParams.pair_Flag,mainParams.chfield, path = par_path).write()

            #write targ_rec_par
            par.TargRecParams(mainParams.Num_Cam, gvthres, mainParams.Tol_Disc,\
                    mainParams.Min_Npix ,mainParams.Max_Npix,\
                    mainParams.Min_Npix_x, mainParams.Max_Npix_x,\
                    mainParams.Min_Npix_y, mainParams.Max_Npix_y,\
                    mainParams.Sum_Grey, mainParams.Size_Cross, path = par_path).write()
            #write pft_version_par
            par.PftVersionParams(mainParams.Existing_Target,
                                 path=par_path).write()
            #write sequence_par
            par.SequenceParams(mainParams.Num_Cam, base_name,\
                     mainParams.Seq_First, mainParams.Seq_Last, path = par_path).write()
            #write criteria_par
            par.CriteriaParams(X_lay,Zmin_lay,Zmax_lay,mainParams.Min_Corr_nx,\
                    mainParams.Min_Corr_ny,mainParams.Min_Corr_npix ,\
                    mainParams.Sum_gv,mainParams.Min_Weight_corr ,\
                    mainParams.Tol_Band, path = par_path).write()
예제 #3
0
    def _reload(self):
        # load ptv_par
        ptvParams = par.PtvParams(path=self.par_path)
        ptvParams.read()

        for i in range(ptvParams.n_img):
            exec('self.Name_%d_Image = ptvParams.img_name[%d]' % (i + 1, i))
            exec('self.Cali_%d_Image = ptvParams.img_cal[%d]' % (i + 1, i))

        self.Refr_Air = ptvParams.mmp_n1
        self.Refr_Glass = ptvParams.mmp_n2
        self.Refr_Water = ptvParams.mmp_n3
        self.Thick_Glass = ptvParams.mmp_d
        self.Accept_OnlyAllCameras = np.bool(ptvParams.allCam_flag)
        self.Num_Cam = ptvParams.n_img
        self.HighPass = np.bool(ptvParams.hp_flag)
        # load unused
        self.tiff_flag = np.bool(ptvParams.tiff_flag)
        self.imx = ptvParams.imx
        self.imy = ptvParams.imy
        self.pix_x = ptvParams.pix_x
        self.pix_y = ptvParams.pix_y
        self.chfield = ptvParams.chfield

        # read_calibration parameters
        calOriParams = par.CalOriParams(ptvParams.n_img, path=self.par_path)
        calOriParams.read()

        self.pair_Flag = np.bool(calOriParams.pair_flag)
        self.img_cal_name = calOriParams.img_cal_name
        self.img_ori = calOriParams.img_ori
        self.fixp_name = calOriParams.fixp_name

        # load read_targ_rec
        targRecParams = par.TargRecParams(ptvParams.n_img, path=self.par_path)
        targRecParams.read()

        for i in range(ptvParams.n_img):
            exec("self.Gray_Tresh_{0} = targRecParams.gvthres[{1}]".format(
                i + 1, i))

        self.Min_Npix = targRecParams.nnmin
        self.Max_Npix = targRecParams.nnmax
        self.Min_Npix_x = targRecParams.nxmin
        self.Max_Npix_x = targRecParams.nxmax
        self.Min_Npix_y = targRecParams.nymin
        self.Max_Npix_y = targRecParams.nymax
        self.Sum_Grey = targRecParams.sumg_min
        self.Tol_Disc = targRecParams.disco
        self.Size_Cross = targRecParams.cr_sz

        # load pft_version
        pftVersionParams = par.PftVersionParams(path=self.par_path)
        pftVersionParams.read()
        self.Existing_Target = np.bool(pftVersionParams.Existing_Target)

        # load sequence_par
        sequenceParams = par.SequenceParams(ptvParams.n_img,
                                            path=self.par_path)
        sequenceParams.read()

        for i in range(ptvParams.n_img):
            exec(
                "self.Basename_{0}_Seq = sequenceParams.base_name[{1}]".format(
                    i + 1, i))

        self.Seq_First = sequenceParams.first
        self.Seq_Last = sequenceParams.last

        # load criteria_par
        criteriaParams = par.CriteriaParams(path=self.par_path)
        criteriaParams.read()
        self.Xmin = criteriaParams.X_lay[0]
        self.Xmax = criteriaParams.X_lay[1]
        self.Zmin1 = criteriaParams.Zmin_lay[0]
        self.Zmin2 = criteriaParams.Zmin_lay[1]
        self.Zmax1 = criteriaParams.Zmax_lay[0]
        self.Zmax2 = criteriaParams.Zmax_lay[1]
        self.Min_Corr_nx = criteriaParams.cnx
        self.Min_Corr_ny = criteriaParams.cny
        self.Min_Corr_npix = criteriaParams.cn
        self.Sum_gv = criteriaParams.csumg
        self.Min_Weight_corr = criteriaParams.corrmin
        self.Tol_Band = criteriaParams.eps0
예제 #4
0
    def _reload(self):
        # load ptv_par
        ptvParams = par.PtvParams(path=self.par_path)
        ptvParams.read()
        (n_img, img_name, img_cal, hp_flag, allCam_flag, tiff_flag, imx, imy, pix_x, pix_y, chfield, mmp_n1, mmp_n2, mmp_n3, mmp_d) = \
            (ptvParams.n_img, ptvParams.img_name, ptvParams.img_cal, ptvParams.hp_flag, ptvParams.allCam_flag, ptvParams.tiff_flag,
             ptvParams.imx, ptvParams.imy, ptvParams.pix_x, ptvParams.pix_y, ptvParams.chfield, ptvParams.mmp_n1, ptvParams.mmp_n2, ptvParams.mmp_n3, ptvParams.mmp_d)

        self.Name_1_Image = img_name[0]
        self.Name_2_Image = img_name[1]
        self.Name_3_Image = img_name[2]
        self.Name_4_Image = img_name[3]
        self.Cali_1_Image = img_cal[0]
        self.Cali_2_Image = img_cal[1]
        self.Cali_3_Image = img_cal[2]
        self.Cali_4_Image = img_cal[3]
        self.Refr_Air = mmp_n1
        self.Refr_Glass = mmp_n2
        self.Refr_Water = mmp_n3
        self.Thick_Glass = mmp_d
        self.Accept_OnlyAllCameras = n.bool(allCam_flag)
        self.Num_Cam = n_img
        self.HighPass = n.bool(hp_flag)
        # load unused
        self.tiff_flag = n.bool(tiff_flag)
        self.imx = imx
        self.imy = imy
        self.pix_x = pix_x
        self.pix_y = pix_y
        self.chfield = chfield

        # read_calibration parameters
        calOriParams = par.CalOriParams(n_img, path=self.par_path)
        calOriParams.read()
        (fixp_name, img_cal_name, img_ori, tiff_flag, pair_flag, chfield) = \
            (calOriParams.fixp_name, calOriParams.img_cal_name, calOriParams.img_ori,
             calOriParams.tiff_flag, calOriParams.pair_flag, calOriParams.chfield)
        self.pair_Flag = n.bool(pair_flag)
        self.img_cal_name = img_cal_name
        self.img_ori = img_ori
        self.fixp_name = fixp_name

        # load read_targ_rec
        targRecParams = par.TargRecParams(n_img, path=self.par_path)
        targRecParams.read()
        (gvthres, disco, nnmin, nnmax, nxmin, nxmax, nymin, nymax, sumg_min, cr_sz) = \
            (targRecParams.gvthres, targRecParams.disco, targRecParams.nnmin, targRecParams.nnmax, targRecParams.nxmin,
             targRecParams.nxmax, targRecParams.nymin, targRecParams.nymax, targRecParams.sumg_min, targRecParams.cr_sz)
        self.Gray_Tresh_1 = gvthres[0]
        self.Gray_Tresh_2 = gvthres[1]
        self.Gray_Tresh_3 = gvthres[2]
        self.Gray_Tresh_4 = gvthres[3]
        self.Min_Npix = nnmin
        self.Max_Npix = nnmax
        self.Min_Npix_x = nxmin
        self.Max_Npix_x = nxmax
        self.Min_Npix_y = nymin
        self.Max_Npix_y = nymax
        self.Sum_Grey = sumg_min
        self.Tol_Disc = disco
        self.Size_Cross = cr_sz

        # load pft_version
        pftVersionParams = par.PftVersionParams(path=self.par_path)
        pftVersionParams.read()
        self.Existing_Target = n.bool(pftVersionParams.Existing_Target)

        # load sequence_par
        sequenceParams = par.SequenceParams(n_img, path=self.par_path)
        sequenceParams.read()
        (base_name, first, last) = \
            (sequenceParams.base_name, sequenceParams.first, sequenceParams.last)
        self.Basename_1_Seq = base_name[0]
        self.Basename_2_Seq = base_name[1]
        self.Basename_3_Seq = base_name[2]
        self.Basename_4_Seq = base_name[3]
        self.Seq_First = first
        self.Seq_Last = last

        # load criteria_par
        criteriaParams = par.CriteriaParams(path=self.par_path)
        criteriaParams.read()
        (X_lay, Zmin_lay, Zmax_lay, cnx, cny, cn, csumg, corrmin, eps0) = \
            (criteriaParams.X_lay, criteriaParams.Zmin_lay, criteriaParams.Zmax_lay, criteriaParams.cnx,
             criteriaParams.cny, criteriaParams.cn, criteriaParams.csumg, criteriaParams.corrmin, criteriaParams.eps0)
        self.Xmin = X_lay[0]
        self.Xmax = X_lay[1]
        self.Zmin1 = Zmin_lay[0]
        self.Zmin2 = Zmin_lay[1]
        self.Zmax1 = Zmax_lay[0]
        self.Zmax2 = Zmax_lay[1]
        self.Min_Corr_nx = cnx
        self.Min_Corr_ny = cny
        self.Min_Corr_npix = cn
        self.Sum_gv = csumg
        self.Min_Weight_corr = corrmin
        self.Tol_Band = eps0