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 Center および File ExchangeHistorical Contests についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by