how to swap bit plane???

2 vues (au cours des 30 derniers jours)
Surya R
Surya R le 25 Oct 2018
Commenté : Walter Roberson le 26 Oct 2018
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 ???

Réponse acceptée

Walter Roberson
Walter Roberson le 25 Oct 2018
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 commentaires
Image Analyst
Image Analyst le 26 Oct 2018
Why? Just for curiosity to see what it looks like? Or do you have an actual real-world "use case"?
Walter Roberson
Walter Roberson le 26 Oct 2018
I rather suspect that "image encryption" will form part of the answer.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Historical Contests 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