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!