How to show the encrypted share for the Jarvis halftone algorithm in following code?
1 view (last 30 days)
Show older comments
How to show the encrypted share for the Jarvis halftone algorithm?
[Merged from duplicate]
function outImg = jarvisHalftone(inImg)
a = imread('D:\our project\crypt\rose.jpg');
figure
imshow(a);
I = rgb2gray(a);
inImg = double(I);
figure
imshow(inImg);
[M,N] = size(inImg);
T = 127.5;
y = inImg;
error = 0;
y= [127.5*ones(M,2) y 127.5*ones(M,2) ; 127.5*ones(2,N+4)];
z = y;
M
N
for rows = 1:M
for cols = 3:N+2
z(rows,cols) =255*(y(rows,cols)>=T);
error = -z(rows,cols) + y(rows,cols);
y(rows,cols+2) = 5/48 * error + y(rows,cols+2);
y(rows,cols+1) = 7/48 * error + y(rows,cols+1);
y(rows+1,cols+2) = 3/48 * error + y(rows+1,cols+2);
y(rows+1,cols+1) = 5/48 * error + y(rows+1,cols+1);
y(rows+1,cols+0) = 7/48 * error + y(rows+1,cols+0);
y(rows+1,cols-1) = 5/48 * error + y(rows+1,cols-1);
y(rows+1,cols-2) = 3/48 * error + y(rows+1,cols-2);
y(rows+2,cols+2) = 1/48 * error + y(rows+2,cols+2);
y(rows+2,cols+1) = 3/48 * error + y(rows+2,cols+1);
y(rows+2,cols+0) = 5/48 * error + y(rows+2,cols+0);
y(rows+2,cols-1) = 3/48 * error + y(rows+2,cols-1);
y(rows+2,cols-2) = 1/48 * error + y(rows+2,cols-2);
end
end
figure
imshow(z);
outImg = z(1:M,3:N+2);
figure
imshow(outImg);
outImg = im2bw(uint8(outImg));
figure
imshow(outImg)
5 Comments
Walter Roberson
on 22 Feb 2017
It would help if you posted a copy of your rose.jpg image along with a copy of the image we should be looking to extract (so we would be able to recognize it.)
Is your rose.jpg created in the rather uncommon JPEG lossless compression? If not then the JPEG compression process would have damaged the payload. Though perhaps that is part of the challenge, that perhaps all of the shares together should be able to reconstruct the data even in the face of damage?
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!