| 1 |
|
#ifndef lint |
| 2 |
|
static const char RCSid[] = "$Id$"; |
| 3 |
|
#endif |
| 4 |
< |
/* EVALGLARE V2.00 |
| 4 |
> |
/* EVALGLARE V2.06 |
| 5 |
|
* Evalglare Software License, Version 2.0 |
| 6 |
|
* |
| 7 |
|
* Copyright (c) 1995 - 2016 Fraunhofer ISE, EPFL. |
| 318 |
|
*/ |
| 319 |
|
/* evalglare.c, v2.02 2017/02/28 change of warning message, when invalid exposure setting is found. Reason: tab removal is not in all cases the right measure - it depends which tool caused the invalid exposure entry */ |
| 320 |
|
|
| 321 |
< |
/* evalglare.c, v2.03 2017/08/12 ad of -O option - disk replacement by providing luminance, not documented |
| 322 |
< |
remove some minor memory leakages, clean up initialization by C. Reetz |
| 321 |
> |
/* evalglare.c, v2.03 2017/08/04 ad of -O option - disk replacement by providing luminance, not documented |
| 322 |
|
*/ |
| 323 |
|
|
| 324 |
+ |
/* evalglare.c, v2.04 2017/08/04 adding -q option: use of Ev/pi as background luminance. not documented. no combination with -n option!!! |
| 325 |
+ |
*/ |
| 326 |
|
|
| 327 |
< |
|
| 328 |
< |
#ifndef EVALGLARE |
| 327 |
> |
/* evalglare.c, v2.05 2018/08/28 change of the -q option for the choice of the background luminance calculation mode: 0: CIE method (Ev-Edir)/pi, 1: mathematical correct average background luminance, 2: Ev/pi. |
| 328 |
> |
change of default options: |
| 329 |
> |
- cosinus weighted calculation of the background luminance (according to CIE) is now default. |
| 330 |
> |
- absolute threshold for the glare source detection is now default (2000cd/m2), based on study of C. Pierson |
| 331 |
> |
*/ |
| 332 |
> |
|
| 333 |
> |
/* evalglare.c, v2.06 2018/08/29 |
| 334 |
> |
change of default value of multiplier b to 5.0, if task options (-t or -T ) are activated AND -b NOT used. To be downward compatible when using the task method. |
| 335 |
> |
*/ |
| 336 |
> |
|
| 337 |
> |
|
| 338 |
|
#define EVALGLARE |
| 329 |
– |
#endif |
| 339 |
|
#define PROGNAME "evalglare" |
| 340 |
< |
#define VERSION "2.03 release 12.08.2017 by EPFL, J.Wienold" |
| 340 |
> |
#define VERSION "2.06 release 29.08.2018 by EPFL, J.Wienold" |
| 341 |
|
#define RELEASENAME PROGNAME " " VERSION |
| 342 |
|
|
| 343 |
|
|
| 1402 |
|
pict *pm = pict_create(); |
| 1403 |
|
int skip_second_scan,calcfast,age_corr,cut_view,cut_view_type,calc_vill, output, detail_out2, x1,y1, fill, yfillmax, yfillmin, |
| 1404 |
|
ext_vill, set_lum_max, set_lum_max2, img_corr,x_disk,y_disk,task_color, i_splitstart,zones,act_gsn,splitgs, |
| 1405 |
< |
i_split, posindex_2, task_lum, checkfile, rval, i, i_max, x, y,x2,y2,x_zone,y_zone, i_z1, i_z2, |
| 1405 |
> |
i_split, posindex_2, task_lum, checkfile, rval, i, i_max, x, y,x2,y2,x_zone,y_zone, i_z1, i_z2, thres_activate, |
| 1406 |
|
igs, actual_igs, lastpixelwas_gs, icol, xt, yt, change,checkpixels, before_igs, sgs, splithigh,uniform_gs,x_max, y_max,y_mid, |
| 1407 |
|
detail_out, posindex_picture, non_cos_lb, rx, ry, rmx,rmy,apply_disability,band_calc,band_color,masking,i_mask,no_glaresources,force; |
| 1408 |
|
double LUM_replace,lum_total_max,age_corr_factor,age,dgp_ext,dgp,low_light_corr,omega_cos_contr, setvalue, lum_ideal, E_v_contr, sigma,om,delta_E, |
| 1419 |
|
float lum_task, lum_thres, dgi, vcp, cgi, ugr, limit, dgr, |
| 1420 |
|
abs_max, Lveil; |
| 1421 |
|
char maskfile[500],file_out[500], file_out2[500], version[500]; |
| 1422 |
< |
char *cline = NULL; |
| 1422 |
> |
char *cline; |
| 1423 |
|
VIEW userview = STDVIEW; |
| 1424 |
|
int gotuserview = 0; |
| 1425 |
< |
struct muc_rvar* s_mask = NULL; |
| 1417 |
< |
struct muc_rvar* s_band = NULL; |
| 1418 |
< |
struct muc_rvar* s_z1 = NULL; |
| 1419 |
< |
struct muc_rvar* s_z2 = NULL; |
| 1420 |
< |
struct muc_rvar* s_noposweight = NULL; |
| 1421 |
< |
struct muc_rvar* s_posweight = NULL; |
| 1422 |
< |
struct muc_rvar* s_posweight2 = NULL; |
| 1423 |
< |
|
| 1424 |
< |
// initializing variables .... |
| 1425 |
< |
Lveil = lum_backg_cos = 0; |
| 1426 |
< |
dgi = ugr = ugp = ugr_exp = dgi_mod = cgi = dgr = vcp = 0.0; |
| 1427 |
< |
lum_task = lum_thres = limit = 0; |
| 1425 |
> |
struct muc_rvar* s_mask; |
| 1426 |
|
s_mask = muc_rvar_create(); |
| 1427 |
< |
muc_rvar_set_dim(s_mask, 1); |
| 1427 |
> |
muc_rvar_set_dim(s_mask, 1); |
| 1428 |
|
muc_rvar_clear(s_mask); |
| 1429 |
+ |
struct muc_rvar* s_band; |
| 1430 |
|
s_band = muc_rvar_create(); |
| 1431 |
< |
muc_rvar_set_dim(s_band, 1); |
| 1431 |
> |
muc_rvar_set_dim(s_band, 1); |
| 1432 |
|
muc_rvar_clear(s_band); |
| 1433 |
+ |
struct muc_rvar* s_z1; |
| 1434 |
|
s_z1 = muc_rvar_create(); |
| 1435 |
< |
muc_rvar_set_dim(s_z1, 1); |
| 1435 |
> |
muc_rvar_set_dim(s_z1, 1); |
| 1436 |
|
muc_rvar_clear(s_z1); |
| 1437 |
|
|
| 1438 |
+ |
struct muc_rvar* s_z2; |
| 1439 |
|
s_z2 = muc_rvar_create(); |
| 1440 |
< |
muc_rvar_set_dim(s_z2, 1); |
| 1440 |
> |
muc_rvar_set_dim(s_z2, 1); |
| 1441 |
|
muc_rvar_clear(s_z2); |
| 1442 |
|
|
| 1443 |
+ |
struct muc_rvar* s_noposweight; |
| 1444 |
|
s_noposweight = muc_rvar_create(); |
| 1445 |
< |
muc_rvar_set_dim(s_noposweight, 1); |
| 1445 |
> |
muc_rvar_set_dim(s_noposweight, 1); |
| 1446 |
|
muc_rvar_clear(s_noposweight); |
| 1447 |
|
|
| 1448 |
+ |
struct muc_rvar* s_posweight; |
| 1449 |
|
s_posweight = muc_rvar_create(); |
| 1450 |
< |
muc_rvar_set_dim(s_posweight, 1); |
| 1450 |
> |
muc_rvar_set_dim(s_posweight, 1); |
| 1451 |
|
muc_rvar_clear(s_posweight); |
| 1452 |
|
|
| 1453 |
+ |
struct muc_rvar* s_posweight2; |
| 1454 |
|
s_posweight2 = muc_rvar_create(); |
| 1455 |
< |
muc_rvar_set_dim(s_posweight2, 1); |
| 1455 |
> |
muc_rvar_set_dim(s_posweight2, 1); |
| 1456 |
|
muc_rvar_clear(s_posweight2); |
| 1457 |
|
|
| 1458 |
|
/*set required user view parameters to invalid values*/ |
| 1519 |
|
omega_cos_contr = 0.0; |
| 1520 |
|
lum_ideal = 0.0; |
| 1521 |
|
max_angle = 0.2; |
| 1522 |
< |
lum_thres = 5.0; |
| 1522 |
> |
lum_thres = 2000.0; |
| 1523 |
|
task_lum = 0; |
| 1524 |
|
sgs = 0; |
| 1525 |
|
splithigh = 1; |
| 1537 |
|
c1 = 5.87e-05; |
| 1538 |
|
c2 = 0.092; |
| 1539 |
|
c3 = 0.159; |
| 1540 |
< |
non_cos_lb = 1; |
| 1540 |
> |
non_cos_lb = 0; |
| 1541 |
|
posindex_2 = 0; |
| 1542 |
|
task_color = 0; |
| 1543 |
|
limit = 50000.0; |
| 1560 |
|
i_mask=0; |
| 1561 |
|
actual_igs=0; |
| 1562 |
|
LUM_replace=0; |
| 1563 |
+ |
thres_activate=0; |
| 1564 |
|
/* command line for output picture*/ |
| 1565 |
|
|
| 1566 |
|
cline = (char *) malloc(CLINEMAX+1); |
| 1611 |
|
break; |
| 1612 |
|
case 'b': |
| 1613 |
|
lum_thres = atof(argv[++i]); |
| 1614 |
+ |
thres_activate = 1; |
| 1615 |
|
break; |
| 1616 |
|
case 'c': |
| 1617 |
|
checkfile = 1; |
| 1712 |
|
break; |
| 1713 |
|
|
| 1714 |
|
|
| 1715 |
< |
case 'n': |
| 1715 |
> |
/* deactivated case 'n': |
| 1716 |
|
non_cos_lb = 0; |
| 1717 |
|
break; |
| 1718 |
+ |
*/ |
| 1719 |
+ |
case 'q': |
| 1720 |
+ |
non_cos_lb = atoi(argv[++i]); |
| 1721 |
+ |
break; |
| 1722 |
|
|
| 1723 |
|
case 't': |
| 1724 |
|
task_lum = 1; |
| 1820 |
|
} |
| 1821 |
|
} |
| 1822 |
|
|
| 1823 |
+ |
/* set multiplier for task method to 5, if not specified */ |
| 1824 |
+ |
|
| 1825 |
+ |
if ( task_lum == 1 && thres_activate == 0){ |
| 1826 |
+ |
lum_thres = 5.0; |
| 1827 |
+ |
} |
| 1828 |
|
/*fast calculation, if gendgp_profile is used: No Vertical illuminance calculation, only dgp is calculated*/ |
| 1829 |
|
|
| 1830 |
|
if (output == 1 && ext_vill == 1 ) { |
| 2123 |
|
lum_pos_mean= lum_pos_mean/sang; |
| 2124 |
|
lum_pos2_mean= lum_pos2_mean/sang; |
| 2125 |
|
|
| 2126 |
< |
// XXX: sure this works? I'd suggest parenthesis. |
| 2112 |
< |
if ((set_lum_max2 >= 1 && E_v_contr > 0 && (E_vl_ext - E_v) > 0) || set_lum_max2==3) { |
| 2126 |
> |
if ((set_lum_max2 >= 1 && E_v_contr > 0 && (E_vl_ext - E_v) > 0 ) || set_lum_max2==3) { |
| 2127 |
|
|
| 2128 |
|
if (set_lum_max2<3){ |
| 2129 |
|
lum_ideal = (E_vl_ext - E_v + E_v_contr) / omega_cos_contr; |
| 2554 |
|
lum_backg = lum_backg_cos; |
| 2555 |
|
} |
| 2556 |
|
|
| 2557 |
+ |
if (non_cos_lb == 2) { |
| 2558 |
+ |
lum_backg = E_v / 3.1415927; |
| 2559 |
+ |
} |
| 2560 |
+ |
|
| 2561 |
+ |
|
| 2562 |
|
/* file writing NOT here |
| 2563 |
|
if (checkfile == 1) { |
| 2564 |
|
pict_write(p, file_out); |
| 2940 |
|
} |
| 2941 |
|
|
| 2942 |
|
|
| 2943 |
< |
pict_free(p); |
| 2925 |
< |
pict_free(pm); |
| 2926 |
< |
muc_rvar_free(s_mask); |
| 2927 |
< |
muc_rvar_free(s_band); |
| 2928 |
< |
muc_rvar_free(s_z1); |
| 2929 |
< |
muc_rvar_free(s_z2); |
| 2930 |
< |
muc_rvar_free(s_noposweight); |
| 2931 |
< |
muc_rvar_free(s_posweight); |
| 2932 |
< |
muc_rvar_free(s_posweight2); |
| 2933 |
< |
free(cline); |
| 2943 |
> |
|
| 2944 |
|
return EXIT_SUCCESS; |
| 2945 |
+ |
exit(0); |
| 2946 |
|
|
| 2947 |
|
userr: |
| 2948 |
|
fprintf(stderr, |
| 2949 |
|
"Usage: %s [-s][-d][-c picture][-t xpos ypos angle] [-T xpos ypos angle] [-b fact] [-r angle] [-y] [-Y lum] [-i Ev] [-I Ev ymax ymin] [-v] picfile\n", |
| 2950 |
|
progname); |
| 2951 |
< |
pict_free(p); |
| 2941 |
< |
pict_free(pm); |
| 2942 |
< |
muc_rvar_free(s_mask); |
| 2943 |
< |
muc_rvar_free(s_band); |
| 2944 |
< |
muc_rvar_free(s_z1); |
| 2945 |
< |
muc_rvar_free(s_z2); |
| 2946 |
< |
muc_rvar_free(s_noposweight); |
| 2947 |
< |
muc_rvar_free(s_posweight); |
| 2948 |
< |
muc_rvar_free(s_posweight2); |
| 2949 |
< |
free(cline); |
| 2950 |
< |
return 1; |
| 2951 |
> |
exit(1); |
| 2952 |
|
} |
| 2953 |
|
|
| 2954 |
|
|