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

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 Comment

  • Click the Help button above the edit-box, in which you write your question.

Answers (1)

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?

This question is closed.

Asked:

on 10 Apr 2017

Closed:

on 10 Apr 2017

Community Treasure Hunt

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

Start Hunting!