예제 #1
0
int load_calibration (Desktop * d)
{
    char *s;
    s = Cgetfile (0, 0, 0, d->image_dir, d->cal_file ? d->cal_file : "", \
			    " Load Calibration File ");
    if (s)
	if (*s) {
	    load_calibration_file (d, s);
	    return 0;
	}
    return 1;
}
예제 #2
0
bool read_isosplit_calibration(int N,QVector<double> &avg,QVector<double> &stdev,QVector<double> &scores) {
	if (s_calibration_dir.isEmpty()) set_calibration_dir();
    if (s_calibration_dir.isEmpty()) {printf ("Error: unable to find isosplit calibration directory (isosplit_calibration)\n"); return false;}
	if (s_calibration_Ns.isEmpty()) set_calibration_Ns();
	int ii=-1;
	while ((ii+2<s_calibration_Ns.count())&&(s_calibration_Ns[ii+1]<=N)) ii++;
    if ((ii<0)||(ii+1>=s_calibration_Ns.count())) {printf ("Error: calibration out of range (N=%d)\n",N); return false;}
	int N1=s_calibration_Ns[ii];
	int N2=s_calibration_Ns[ii+1];
	if (N1==N) N2=N1;
	if (!s_calibration_files.contains(N1)) {
		load_calibration_file(N1);
        if (!s_calibration_files.contains(N1)) {printf ("Error: unable to find calibration file (N=%d)\n",N1); return false;}
	}
	if (!s_calibration_files.contains(N2)) {
		load_calibration_file(N2);
        if (!s_calibration_files.contains(N2)) {printf ("Error: unable to find calibration file (N=%d)\n",N2); return false;}
	}
	if (N1==N2) {
		calibration_file *CF=&s_calibration_files[N1];
		avg=CF->avg; stdev=CF->stdev; scores=CF->scores;
	}
	else {
		double pct=(N-N1)*1.0/(N2-N1);
		calibration_file *CF1=&s_calibration_files[N1];
		calibration_file *CF2=&s_calibration_files[N2];
		avg=CF1->avg; stdev=CF1->stdev; scores=CF1->scores;
		for (int i=0; i<avg.count(); i++) {
			avg[i]=avg[i]+pct*(CF2->avg[i]-avg[i]);
			stdev[i]=stdev[i]+pct*(CF2->stdev[i]-stdev[i]);
		}
		for (int i=0; i<scores.count(); i++) {
			scores[i]=scores[i]+pct*(CF2->scores[i]-scores[i]);
		}
	}
	return true;
}