Matlab - showBitPlanes


/ Published in: MatLab
Save to your folder(s)



Copy this code and paste it in your HTML
  1. % Ritorna i Bit Plabes dell'immagine a toni di grigio
  2.  
  3. function showBitPlanes(img)
  4.  
  5. imgGray = double( rgb2gray(img) );
  6. titleString = 'bit planes ';
  7.  
  8. % MSB ... LSB
  9. k = 128;
  10.  
  11. for b=1:8
  12.  
  13. subplot(2, 4, b);
  14. imshow( (bitand(imgGray, k) / k) * 255 ); % Fa un and dei bit
  15. title([titleString int2str(b-1)]);
  16. k = k/2; % Shifta di 2 i bit
  17.  
  18. end;
  19.  
  20. return;

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.