Info

此问题已关闭。 请重新打开它进行编辑或回答。

can anyone explain what does this code do? Thanks in advance

1 次查看(过去 30 天)
clc;
clear all;
close all;
imag1 = imread('peppers.png');
imag2=rgb2gray(imag1);
x= imresize(imag2, [64, 64]);
[n,m,k]=size(x);
b=8;
n=n*b*m;
bi = zeros(n,1,'uint8');
c = 0.3;
tic;
for i = 2 : n
sum = 1 - 2* c * c;
if (sum<0.0)
bi(i-1) = 1;
end
c = sum;
end
key = zeros(n/b,1,'uint8');
for i1 = 1 : n/b
for i2 = 1 : b
key(i1) = key(i1) + bi(i2*i1)* 2^(i2-1);
end
end;
[n, m, k] = size(x)
for ind = 1 : m
Fkey(:,ind) = key((1+(ind-1)*n) : (((ind-1)*n)+n));
end
for i3 = 1 : k
x1= x(:,:,i3);
for i4 = 1 : n
for i5=1:m
y(i4,i5) = bitxor(x1(i4,i5),Fkey(i4,i5));
end
end
xout(:,:,i3) = y(:,:,1);
end;

回答(1 个)

Walter Roberson
Walter Roberson 2017-4-10
What does the program documentation say about what it does and how it works? What did the author of the code say when you asked them what the program was for? What were you searching for when you found the code, or did you just ask Google to find yourself a random MATLAB program that you thought you might start learning MATLAB from?

Community Treasure Hunt

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

Start Hunting!

Translated by