hdrvdp_parse_options.m 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. function metric_par = hdrvdp_parse_options( options )
  2. % HDRVDP_PARSE_OPTIONS (internal) parse HDR-VDP options and create two
  3. % structures: view_cond with viewing conditions and metric_par with metric
  4. % parameters
  5. %
  6. % Copyright (c) 2011, Rafal Mantiuk <mantiuk@gmail.com>
  7. % Permission to use, copy, modify, and/or distribute this software for any
  8. % purpose with or without fee is hereby granted, provided that the above
  9. % copyright notice and this permission notice appear in all copies.
  10. %
  11. % THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  12. % WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  13. % MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  14. % ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  15. % WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  16. % ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  17. % OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  18. % Defaults
  19. metric_par.debug = false;
  20. % Peak contrast from Daly's CSF for L_adapt = 30 cd/m^2
  21. daly_peak_contrast_sens = 0.006894596;
  22. %metric_par.sensitivity_correction = daly_peak_contrast_sens / 10.^-2.355708;
  23. metric_par.sensitivity_correction = daly_peak_contrast_sens / 10.^-2.4;
  24. metric_par.view_dist = 0.5;
  25. metric_par.spectral_emission = [];
  26. metric_par.orient_count = 4; % the number of orientations to consider
  27. % Various optional features
  28. metric_par.do_masking = true;
  29. metric_par.do_mtf = true;
  30. metric_par.do_spatial_pooling = true;
  31. metric_par.noise_model = true;
  32. metric_par.do_quality_raw_data = false; % for development purposes only
  33. metric_par.do_si_gauss = false;
  34. metric_par.si_size = 1.008;
  35. % Warning messages
  36. metric_par.disable_lowvals_warning = false;
  37. metric_par.steerpyr_filter = 'sp3Filters';
  38. metric_par.mask_p = 0.544068;
  39. metric_par.mask_self = 0.189065;
  40. metric_par.mask_xo = 0.449199;
  41. metric_par.mask_xn = 1.52512;
  42. metric_par.mask_q = 0.49576;
  43. metric_par.si_size = -0.034244;
  44. metric_par.psych_func_slope = log10(3.5);
  45. metric_par.beta = metric_par.psych_func_slope-metric_par.mask_p;
  46. % Spatial summation
  47. metric_par.si_slope = -0.850147;
  48. metric_par.si_sigma = -0.000502005;
  49. metric_par.si_ampl = 0;
  50. % Cone and rod cvi functions
  51. metric_par.cvi_sens_drop = 0.0704457;
  52. metric_par.cvi_trans_slope = 0.0626528;
  53. metric_par.cvi_low_slope = -0.00222585;
  54. metric_par.rod_sensitivity = 0;
  55. %metric_par.rod_sensitivity = -0.383324;
  56. metric_par.cvi_sens_drop_rod = -0.58342;
  57. % Achromatic CSF
  58. metric_par.csf_m1_f_max = 0.425509;
  59. metric_par.csf_m1_s_high = -0.227224;
  60. metric_par.csf_m1_s_low = -0.227224;
  61. metric_par.csf_m1_exp_low = log10( 2 );
  62. metric_par.csf_params = [ ...
  63. 0.0160737 0.991265 3.74038 0.50722 4.46044
  64. 0.383873 0.800889 3.54104 0.682505 4.94958
  65. 0.929301 0.476505 4.37453 0.750315 5.28678
  66. 1.29776 0.405782 4.40602 0.935314 5.61425
  67. 1.49222 0.334278 3.79542 1.07327 6.4635
  68. 1.46213 0.394533 2.7755 1.16577 7.45665 ];
  69. metric_par.csf_lums = [ 0.002 0.02 0.2 2 20 150];
  70. metric_par.csf_sa = [30.162 4.0627 1.6596 0.2712];
  71. metric_par.csf_sr_par = [1.1732 1.1478 1.2167 0.5547 2.9899 1.1414]; % rod sensitivity function
  72. par = [0.061466549455263 0.99727370023777070]; % old parametrization of MTF
  73. metric_par.mtf_params_a = [par(2)*0.426 par(2)*0.574 (1-par(2))*par(1) (1-par(2))*(1-par(1))];
  74. metric_par.mtf_params_b = [0.028 0.37 37 360];
  75. %metric_par.quality_band_freq = [15 7.5 3.75 1.875 0.9375 0.4688 0.2344];
  76. metric_par.quality_band_freq = [60 30 15 7.5 3.75 1.875 0.9375 0.4688 0.2344 0.1172];
  77. %metric_par.quality_band_w = [0.2963 0.2111 0.1737 0.0581 -0.0280 0.0586 0.2302];
  78. % New quality calibration: LDR + HDR datasets - paper to be published
  79. %metric_par.quality_band_w = [0.2832 0.2142 0.2690 0.0398 0.0003 0.0003 0.0002];
  80. metric_par.quality_band_w = [0 0.2832 0.2832 0.2142 0.2690 0.0398 0.0003 0.0003 0 0];
  81. metric_par.quality_logistic_q1 = 3.455;
  82. metric_par.quality_logistic_q2 = 0.8886;
  83. metric_par.calibration_date = '30 Aug 2011';
  84. metric_par.surround_l = 1e-5;
  85. % process options
  86. i = 1;
  87. while( i <= length( options ) )
  88. if( strcmp( options{i}, 'pixels_per_degree' ) )
  89. i = i+1;
  90. metric_par.pix_per_deg = options{i};
  91. elseif( strcmp( options{i}, 'viewing_distance' ) )
  92. i = i+1;
  93. metric_par.view_dist = options{i};
  94. elseif( strcmp( options{i}, 'peak_sensitivity' ) )
  95. i = i+1;
  96. metric_par.sensitivity_correction = daly_peak_contrast_sens / 10.^(-options{i});
  97. else
  98. % all other options
  99. metric_par.(options{i}) = options{i+1};
  100. i = i+1;
  101. end
  102. i = i+1;
  103. end
  104. end