Advertisement
Guest User

Untitled

a guest
Apr 19th, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. image = imread('./samples/train.bmp');
  2. grayscale = double(rgb2gray(image))/255;
  3.  
  4. hsv_image = rgb2hsv(image);
  5.  
  6. [sizex, sizey] = size(image);
  7.  
  8.  
  9. theta_0 = 0.121779;
  10. theta_1 = 0.959710;
  11. theta_2 = -0.780245;
  12. deviation = 0.041337;
  13.  
  14. depth = theta_0 + theta_1*grayscale+ theta_2*hsv_image(:,:,2);
  15. imshow(depth);
  16. figure;
  17.  
  18. t_min = min(max(exp(-depth)*.9,.1),.9);
  19.  
  20. image_scaled = double(image)/255.0;
  21.  
  22.  
  23. fuzzed_depth = min_filter(depth,10);
  24. order_depth = sort(fuzzed_depth(:),'descend');
  25. min_range = min(order_depth(1:int64((sizex* sizey)*.001)));
  26. A = max(max((fuzzed_depth > min_range) .* grayscale));
  27.  
  28. fprintf('Attenuation:%d \n', A)
  29.  
  30. for i = 1:3
  31. image_scaled(:,:,i) = ((image_scaled(:,:,i)-A) ./ t_min) + A;
  32. end
  33.  
  34. subplot(1,2,1)
  35. imshow(image);
  36. subplot(1,2,2);
  37. imshow(uint8(image_scaled * 255));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement