Guest User

Untitled

a guest
Jan 16th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. function [entropy, bytes_image, bytes_coding] = entropy_single_pixels(im)
  2.  
  3. im = double(im);
  4.  
  5. histg = hist(im);
  6.  
  7. histg(histg==0) = [];
  8. nzhist = histg ./ numel(im);
  9. entropy = -sum(nzhist.*log2(nzhist));
  10.  
  11. bytes_image = (entropy*(numel(im))/8);
  12.  
  13. bytes_coding = 2*numel(unique(im));
  14.  
  15. fprintf('ENTROPY_VALUE:%sn',num2str(entropy));
  16. fprintf('BYTES_IMAGE:%sn',num2str(bytes_image));
  17. fprintf('BYTES_CODING:%sn',num2str(bytes_coding));
  18. end
Add Comment
Please, Sign In to add comment