i want to restore the original binary image S by xor the two shares R1,R2

3 ビュー (過去 30 日間)
dhivya
dhivya 2023 年 3 月 28 日
コメント済み: Walter Roberson 2023 年 3 月 28 日
S = imread('binary.png');
C = imread('text input.png');
[m, n] = size(S);
no = 2;
beta = 1;
R1 = zeros(m, n);
R2 = zeros(m, n);
for i = 1:m
for j = 1:n
d = rand;
if d < beta
"function T = algo2(S(i, j), no)";
R1(i, j) = T(1);
R2(i, j) = T(2);
else
if mod(n*C(i, j), no) == 0
R1(i, j) = C(i, j);
R2(i, j) = C(i, j);
else
f = randi([1 no]);
for k = 1:n
if k == f
R1(i, j) = 1 - C(i, j);
R2(i, j) = 1 - C(i, j);
elseif k < f
R1(i, j) = C(i, j);
R2(i, j) = C(i, j);
else
R1(i, j) = C(i, j);
R2(i, j) = C(i, j);
end
end
end
end
end
end
S_restored = bitxor(R1, R2);
imshow(S_restored);
this is the code for restore the original bianry image,in this the the line "function T = algo2(S(i, j), no)"; calls the another code algo2 for the 2 pixel shares...but the resulting image is full of black.i tried so many times to rectify it.help to get rid of the issue
code for algo2:
function T = algo2(S, n)
S=imread('text input.png');
meven=[0 0 0;
0 1 1;
1 0 1;
1 1 0];
modd=[0 0 1;
0 1 0;
1 0 0;
1 1 1];
no=1;
y =zeros(size(S));
R=zeros(size(S));
l=zeros(size(S));
for i = 1:size(S,1)
for j = 1:size(S,2)
if (S(i, j) == 0)
r=rand([no,2^no-1]);
disp(r)
ro=round(r*(size(meven,1)-1))+1;
disp(ro)
R(i,j)=meven(ro,1);
l(i,j)=meven(ro,2);
else
r=rand([no,2^no-1]);
disp(r)
ro = round(r*(size(modd,1)-1))+1;
disp(ro)
R(i,j)=modd(ro,1);
l(i,j)=modd(ro,2);
end
end
end
y(i,j)=S(i,j);
  2 件のコメント
Image Analyst
Image Analyst 2023 年 3 月 28 日
No idea, because you forgot to attach your two input images. You didn't even attach screenshots, so I gave up at that point.
If you have any more questions, then attach your data and code to read it in with the paperclip icon after you read this:
Walter Roberson
Walter Roberson 2023 年 3 月 28 日
"function T = algo2(S(i, j), no)";
That line just constructs a 1 x 1 string array in which the first element contains ['f' 'u' 'n' 'c' 't' 'i' 'o' 'n' ' ' 'T' ] and so on.

サインインしてコメントする。

回答 (0 件)

カテゴリ

Help Center および File ExchangeProgramming についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by