Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Matlab - showBitPlanes (See related posts)

% Ritorna i Bit Plabes dell'immagine a toni di grigio

function showBitPlanes(img)

    imgGray = double( rgb2gray(img) );
    titleString = 'bit planes ';
    
    % MSB ... LSB
    k = 128;
    
    for b=1:8
        
        subplot(2, 4, b);
        imshow( (bitand(imgGray, k) / k) * 255 ); % Fa un and dei bit
        title([titleString int2str(b-1)]);
        k = k/2; % Shifta di 2 i bit
        
    end;
    
return;

You need to create an account or log in to post comments to this site.


Click here to browse all 5140 code snippets

Related Posts