hdrvdp_ncsf.m 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. function S = hdrvdp_ncsf( rho, lum, metric_par )
  2. % Neural contrast sensitivity function
  3. %
  4. % S = hdrvdp_csf( rho, lum, metric_par )
  5. %
  6. % This is a naural contrast sensitivity function, which does not account
  7. % for the optical component, nor luminance-dependent component. To compute
  8. % a complete CSF, use:
  9. %
  10. % CSF = hdrvdp_csf( rho, lum, metric_par ) * hdrvdp_mtf( rho, metric_par ) *
  11. % hdrvdp_joint_rod_cone_sens( lum, metric_par );
  12. %
  13. % Note that the peaks of nCSF are not normalized to 1. This is to account
  14. % for the small variations in the c.v.i. (sensitivity due to adapting
  15. % luminance).
  16. %
  17. % Copyright (c) 2011, Rafal Mantiuk <mantiuk@gmail.com>
  18. % Permission to use, copy, modify, and/or distribute this software for any
  19. % purpose with or without fee is hereby granted, provided that the above
  20. % copyright notice and this permission notice appear in all copies.
  21. %
  22. % THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  23. % WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  24. % MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  25. % ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  26. % WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  27. % ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  28. % OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  29. csf_pars = metric_par.csf_params;
  30. lum_lut = log10(metric_par.csf_lums);
  31. log_lum = log10( lum );
  32. par = zeros(length(lum),4);
  33. for k=1:4
  34. par(:,k) = interp1( lum_lut, csf_pars(:,k+1), clamp( log_lum, lum_lut(1), lum_lut(end) ) );
  35. end
  36. S = par(:,4) .* 1./((1+(par(:,1).*rho).^par(:,2)) .* 1./(1-exp(-(rho/7).^2)).^par(:,3)).^0.5;
  37. end