how to swap bit plane???

조회 수: 2 (최근 30일)
Surya R
Surya R 2018년 10월 25일
댓글: Walter Roberson 2018년 10월 26일
it is bitplane decomposition code..i want to swap them.. how to do it???
g=imread('girl.png');
g=rgb2gray(I_scramble);
g1=bitget(g,1);
g2=bitget(g,2);
g3=bitget(g,3);
g4=bitget(g,4);
g5=bitget(g,5);
g6=bitget(g,6);
g7=bitget(g,7);
g8=bitget(g,8);
figure,imshow(g);
title('original image');
subplot(4,4,1),imshow(logical(g1)),title('Bit 1');
subplot(4,4,2),imshow(logical(g2)),title('Bit 2');
subplot(4,4,3),imshow(logical(g3)),title('Bit 3');
subplot(4,4,4),imshow(logical(g4)),title('Bit 4');
subplot(4,4,5),imshow(logical(g5)),title('Bit 5');
subplot(4,4,6),imshow(logical(g6)),title('Bit 6');
subplot(4,4,7),imshow(logical(g7)),title('Bit 7');
subplot(4,4,8),imshow(logical(g8)),title('Bit 8');
%L=imread('monarch.png');
L=rgb2gray(I1_scramble);
L1=bitget(L,1);
L2=bitget(L,2);
L3=bitget(L,3);
L4=bitget(L,4);
L5=bitget(L,5);
L6=bitget(L,6);
L7=bitget(L,7);
L8=bitget(L,8);
figure,imshow(L);
title('original image');
subplot(4,4,1),imshow(logical(L1)),title('Bit 1');
subplot(4,4,2),imshow(logical(L2)),title('Bit 2');
subplot(4,4,3),imshow(logical(L3)),title('Bit 3');
subplot(4,4,4),imshow(logical(L4)),title('Bit 4');
subplot(4,4,5),imshow(logical(L5)),title('Bit 5');
subplot(4,4,6),imshow(logical(L6)),title('Bit 6');
subplot(4,4,7),imshow(logical(L7)),title('Bit 7');
subplot(4,4,8),imshow(logical(L8)),title('Bit 8');
how to swap this ???

채택된 답변

Walter Roberson
Walter Roberson 2018년 10월 25일
gall = cat(3, g1, g2, g3, g4, g5, g6, g7, g8);
gall_scramble = gall(:, :, randperm(8));
gscramble = zeros(size(g));
for p = 1 : 8
gscramble = bitset(gscramble, p, gall_scramble(:,:,p));
end
  댓글 수: 4
Image Analyst
Image Analyst 2018년 10월 26일
Why? Just for curiosity to see what it looks like? Or do you have an actual real-world "use case"?
Walter Roberson
Walter Roberson 2018년 10월 26일
I rather suspect that "image encryption" will form part of the answer.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Historical Contests에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by