Kiberxavfszlik fanidan


Matlab tizimida tuzilgan dastur


Download 185.78 Kb.
bet10/10
Sana28.12.2022
Hajmi185.78 Kb.
#1023445
1   2   3   4   5   6   7   8   9   10
Bog'liq
bdumalik

Matlab tizimida tuzilgan dastur
function [intl] = embedbp(I,txt,b)
if nargin == 2
b=1;
end
N = 8*numel(txt);
S = numel(I);
if N > S
warning(' Matn rasm oʻlchamida boʻlishi uchun qisqartirildi ')
txt = txt(1:floor(S/8));
N = 8*numel(txt);
end
p = 2^b;
h = 2^(b-1);
I1 = reshape(I,1,S);
addl = S-N;
dim = size(I);
I2 = round(abs(I1(1:N)));
si = sign(I1(1:N));
for k = 1:N
if si(k) == 0
si(k) = 1;
end
I2(k) = round(I2(k));
if mod((I2(k)),p) >= h
I2(k) = I2(k) - h;
end
end
bt = dec2bin(txt,8);
bint = reshape(bt,1,N);
d = h*48;
bi = (h*bint) - d;
I3 = double(I2) + bi;
binadd = [bi zeros(1,addl)];
I4 = double(si).*double(I3);
I5 = [I4 I1(N+1:S)];
intl = reshape(I5,dim);
return
Download 185.78 Kb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9   10




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling