title: Digital image reconstruction with bit planes
body: <p>I am trying to reconstruct an image from extracted bit planes. </p>
  
  <p>Firstly I show the original picture and secondly the pictures per bit-plane.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>I = imread('myphoto.jpg');
  A=bitget(I,1); subplot(3,3,1), imshow(logical(A));title('Bit plane 1');
  A=bitget(I,2); subplot(3,3,2), imshow(logical(A));title('Bit plane 2');
  A=bitget(I,3); subplot(3,3,3), imshow(logical(A));title('Bit plane 3');
  A=bitget(I,4); subplot(3,3,4), imshow(logical(A));title('Bit plane 4');
  A=bitget(I,5); subplot(3,3,5), imshow(logical(A));title('Bit plane 5');
  A=bitget(I,6); subplot(3,3,6), imshow(logical(A));title('Bit plane 6');
  A=bitget(I,7); subplot(3,3,7), imshow(logical(A));title('Bit plane 7');
  A=bitget(I,8); subplot(3,3,8), imshow(logical(A));title('Bit plane 8');
  </code></pre>
  
  <p>Now I want to reconstruct my photo using the bit plane photos. I must start from the most important bit adding the next most important bit etc. I must show all the photos together. I wrote some code like this but I am not sure if this is right.</p>
  
  <pre><code>M1 = bitget(A,8)*2^0;
  M2 = bitget(A,7)*2^1;
  M3 = bitget(A,6)*2^2;
  M4 = bitget(A,5)*2^3;
  M5 = bitget(A,4)*2^4;
  M6 = bitget(A,3)*2^5;
  M7 = bitget(A,2)*2^6;
  M8 = bitget(A,1)*2^7;
  
  figure,subplot(3,3,1),imshow(M1); subplot(3,3,2),imshow(M2); subplot(3,3,3),imshow(M3); subplot(3,3,4),imshow(M4); subplot(3,3,5),imshow(M5); subplot(3,3,6),imshow(M6); subplot(3,3,7),imshow(M7); subplot(3,3,8),imshow(M8);
  </code></pre>