Effacer les filtres
Effacer les filtres

how to save bit plane images created from a gray image

3 vues (au cours des 30 derniers jours)
faraz.a
faraz.a le 29 Mai 2013
this is the code which i wrote
A=imread('boy.tif');
B=bitget(A,1); figure, imshow(logical(B));title('Bit plane 1');imwrite(uint8(B), 'bp0.png');
B=bitget(A,2); figure, imshow(logical(B));title('Bit plane 2');imwrite(uint8(B), 'bp1.png');
B=bitget(A,3); figure, imshow(logical(B));title('Bit plane 3');imwrite(uint8(B), 'bp2.png');
B=bitget(A,4); figure, imshow(logical(B));title('Bit plane 4');imwrite(uint8(B), 'bp3.png');
B=bitget(A,5); figure, imshow(logical(B));title('Bit plane 5');imwrite(uint8(B), 'bp4.png');
B=bitget(A,6); figure, imshow(logical(B));title('Bit plane 6');imwrite(uint8(B), 'bp5.png');
B=bitget(A,7); figure, imshow(logical(B));title('Bit plane 7');imwrite(uint8(B), 'bp6.png');
B=bitget(A,8); figure, imshow(logical(B));title('Bit plane 8');imwrite(uint8(B), 'bp7.png');
then i wrote this
d=imread('bp7.png'); imshow(d)
it displayed a complete black image why is that now?
i want to save those bit plane images how to do that?

Réponses (1)

Walter Roberson
Walter Roberson le 29 Mai 2013
imshow(logical(d))
Otherwise you are attempting to display an image that has some pixels of value 0, and some pixels of value 1, in a situation where imshow() is expecting that the maximum value (white) will be 255. If you switch to logical() then it knows to use 0 for black, 1 for white.

Catégories

En savoir plus sur Image Processing Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by