run.m 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. % Passed using arguments :
  2. % matlab -nodesktop -nodisplay -nosplash -r "path_ref='../../data/Scenes/Appart1opt02/appartAopt_00900.png';path_noisy='../../data/Scenes/Appart1opt02/appartAopt_00050.png';prefix='vdp_appart';run;exit"
  3. %path_ref = '../../data/Scenes/Appart1opt02/appartAopt_00900.png'
  4. %path_noisy = '../../data/Scenes/Appart1opt02/appartAopt_00050.png'
  5. %prefix = 'passed as argument'
  6. T = imread(path_noisy); % images must be normalized 0-1
  7. R = imread(path_ref);
  8. % normalized
  9. T = double(T) / 255.
  10. R = double(R) / 255.
  11. % Compute pixels per degree for the viewing conditions
  12. ppd = hdrvdp_pix_per_deg( 21, [size(T,2) size(T,1)], 1 );
  13. % Run hdrvdp
  14. res1 = hdrvdp( T, R, 'sRGB-Display', 30)
  15. %vdp_img = imshow( hdrvdp_visualize( 'diff', res1.P_map, T, R, {'context_image', T} ) )
  16. % output of
  17. c_map_computed = res1.C_map
  18. c_map_computed(c_map_computed < 0) = 10e-5
  19. c_map_norm = c_map_computed / (max(max(c_map_computed)))
  20. img = hdrvdp_visualize(c_map_computed);
  21. img_mask = hdrvdp_visualize(c_map_computed, T);
  22. img_norm = hdrvdp_visualize(c_map_norm);
  23. img_norm_mask = hdrvdp_visualize(c_map_norm, T);
  24. disp(prefix)
  25. imwrite(img, strcat(prefix, '.png'));
  26. %imwrite(img_mask, strcat(prefix, '_mask.png'));
  27. %imwrite(img_norm, strcat(prefix, '_norm.png'));
  28. %imwrite(img_norm_mask, strcat(prefix, '_norm_mask.png'));
  29. fileID = fopen(strcat(prefix, '_q_max.txt'),'w');
  30. fprintf(fileID, '%3.5f', res1.Q);
  31. fclose(fileID);