how to Extract th​e most sig​nificant b​it plane (​MSB) and t​he least s​ignificant​ bit plane​ (LSB) of ​the  Boy image ​and print ​the binary​ image of ​each bit p​lane 

can anyone tell me how to Extract the most significant bit plane (MSB) and the least significant bit plane (LSB) of the  any image and print the binary image of each bit plane. using matlab and java? if possible c or C++
i know the bit plane slicing but i don't want slicing A=imread('coins.png');
B=bitget(A,1); figure, subplot(2,2,1);imshow(logical(B));title('Bit plane 1');
B=bitget(A,2); subplot(2,2,2);imshow(logical(B));title('Bit plane 2');
B=bitget(A,3); subplot(2,2,3);imshow(logical(B));title('Bit plane 3');
B=bitget(A,4); subplot(2,2,4);imshow(logical(B));title('Bit plane 4');
B=bitget(A,5); figure, subplot(2,2,1);imshow(logical(B));title('Bit plane 5');
B=bitget(A,6); subplot(2,2,2);imshow(logical(B));title('Bit plane 6');
B=bitget(A,7); subplot(2,2,3);imshow(logical(B));title('Bit plane 7');
B=bitget(A,8); subplot(2,2,4);imshow(logical(B));title('Bit plane 8');
is this the way we get the MSB - LSB?
or some other way?

Answers (1)

I'm pretty sure I already gave that to you in your duplicate question: http://www.mathworks.com/matlabcentral/answers/76991#comment_151134 If not, explain why not.

5 Comments

okay so that is one way to get the bit plane images and one more way
% Compute the bit plane image.
bitPlaneImage = bitand(grayImage, 2^bp);
% Display it as pure black and white (not gray scale).
imshow(bitPlaneImage, []);
caption = sprintf('You are now viewing bitplane %d.', bp);
title(caption, 'FontSize', fontSize);
% If it's not the last bit plane, ask them if they want to continue.
if bp ~= 7
message = sprintf('%s\nDo you want to continue', caption);
button = questdlg(message, 'Continue?', 'Yes', 'No', 'Yes');
drawnow; % Refresh screen to get rid of dialog box remnants.
if strcmpi(button, 'No')
break;
end
end
end
I don't understand what you are saying. How is that one more way? That code is just my code from the link I gave you.
yes i meant the below pcode is one way to get bit planes right? and the other way the code which you gave? am i right? A=imread('coins.png');
B=bitget(A,1); figure, subplot(2,2,1);imshow(logical(B));title('Bit plane 1');
B=bitget(A,2); subplot(2,2,2);imshow(logical(B));title('Bit plane 2');
B=bitget(A,3); subplot(2,2,3);imshow(logical(B));title('Bit plane 3');
B=bitget(A,4); subplot(2,2,4);imshow(logical(B));title('Bit plane 4');
B=bitget(A,5); figure, subplot(2,2,1);imshow(logical(B));title('Bit plane 5');
B=bitget(A,6); subplot(2,2,2);imshow(logical(B));title('Bit plane 6');
B=bitget(A,7); subplot(2,2,3);imshow(logical(B));title('Bit plane 7');
B=bitget(A,8); subplot(2,2,4);imshow(logical(B));title('Bit plane 8');
sir when i am writing this code i am getting the bit planes. I saved the bit plane as some image bp0.tif
A=imread('bp0.tif')
it showed it's pixel values few were 0 and most of them were 255 i don't get it how it should be a binary image (bit plane should be a binary image right?) it should show 0 and 1 so that i can make this image in to a form of matrix. the image for from which i got these bit planes was a gray image. please help sir

Sign in to comment.

Categories

Find more on Images in Help Center and File Exchange

Asked:

on 27 May 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!