how to save bit plane images created from a gray image
3 次查看(过去 30 天)
显示 更早的评论
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?
0 个评论
回答(1 个)
Walter Roberson
2013-5-29
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.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Image Processing Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!